The Abacus and The Canvas

Luca Cazzanti's blog

Similarity Discriminant Analysis

Similarity Discriminant Analysis (SDA) is a generative framework for classifying objects based on their pairwise similarity. I developed SDA with Prof. Maya Gupta for my Ph.D. I am posting here the Matlab code for that work for posterity. It's a set of Matlab scripts for similarity discriminant analysis (SDA), including the standard SDA, local SDA, regularized local SDA, mixture SDA, and nnSDA classfiers. This is research-grade code, designed to test ideas and concepts. I have emphasized readability of the source code rather than speed and memory management. It comes with no guarantees, but I hope you will nonetheless find it useful. As examples of how to run the software, I have included the scripts I used to run the algorithms on benchmark datasets. This software has benefitted from other people's helpful suggestions and bug-squashing skills. I want to thank in particular Prof. Maya Gupta of the Dept. EE, University of Washington who was the original force behind the maximum entropy-based aproach to estimating similarity distributions. For the theory of the SDA framework for similarity-based classification, see the publications.

Download the code

  • Aug 9, 2011 - Includes all the previous features, plus multi-task regularized local SDA, and a Matlab implementation of pairwise local SDA.
  • Mar. 08, 2010 - Includes mex files for 32-bit Linux (10 times faster than plain m-scripts), a README to get you started quickly, and a sample data set.
  • Nov. 13, 2009 - Includes the regularized local SDA classifier, which is the state-of-the-art of SDA-type classifiers. Also icludes code for local BDA.
  • Jan. 29, 2009 - First release.


author = "L. Cazzanti",
year = "2011",
month = "August",
title = "Similarity Discriminant Analysis Toolbox",
url = "",
institution = "Applied Physics Laboratory - University of Washington, Seattle"}