1. A method of classifying input data as belonging to one of a plurality of classifications, the plurality of classifications associated with a respective plurality of clusters that were fit to training data, the method comprising: obtaining a first transformation used to transform the training data when the plurality of clusters were fit to the training data, the first transformation approximating at least one constraint relating to a similarity and/or dissimilarity of at least a portion of the training data, wherein the first transformation was determined using a cosine similarity as a measure of the similarity and/or dissimilarity of the at least a portion of the training data; transforming the input data using at least the first transformation to obtain transformed input data; comparing the transformed input data to the plurality of clusters to determine which cluster of the plurality of clusters the input data should be associated with; and classifying the input data according to a classification of the plurality of classifications associated with the cluster that the input data was determined to be associated with, wherein the at least one constraint was specified by identifying a first set of data pairs in the data, the first set of data pairs indicating that the data identified by each respective data pair in the first set of data pairs was associated with a same classification, and was specified by identifying a second set of data pairs in the data, the second set of data pairs indicating that data identified in each respective data pair in the second set of data pairs was associated with a different classification.