Cosine distance and L1-norm for KMeans #2850

wants to merge 15 commits into


None yet

1 participant


Neither one of these added metrics has been added to the mini batch kmeans at this point.

mattilyra added some commits Feb 6, 2014
@mattilyra mattilyra Added distance metric selection capability to kmeans._labels_inertia.…
… Current available metrics are L1 and L2 norm.
@mattilyra mattilyra Added test to check labels assignment and inertia for L1 norm. 7b718e8
@mattilyra mattilyra Made test for labels assignment and inertia for L1 norm pass. 8599ff1
@mattilyra mattilyra Added implementations of L1 norm distance computations for dense and …
…sparse matrices.
@mattilyra mattilyra Added a function to compute the cluster centers when using the L1 nor…
…m (the median of the datapoints in the cluster)).
@mattilyra mattilyra Added metric selection to sklearn.cluster.KMeans 68c8bb9
@mattilyra mattilyra Added cosine distance measure to KMeans. This just normalises the X v…
…ectors to have unit length before they are passed to the k_means function.
@mattilyra mattilyra PEP8 formatting. ca09098
@mattilyra mattilyra Added a check to _k_init that ignores x_squared_norms if the metric i…
…s set the L1 norm.
@mattilyra mattilyra Minor editing to comments. 1ddc004
@mattilyra mattilyra Added 'metric' field to function docstrings in cluster.k_means 4b84a62
@mattilyra mattilyra Fixed an error with _assign_empty_clusters in sklearn.cluster._k_mean…
…s.pyx where the datatype of n_samples_in_cluster was wrong and the dimensionality of distances was wrong.
@mattilyra mattilyra Fixed a massive performance issue in _k_means._assign_labels_csr_L1 ecfea4b
@mattilyra mattilyra Added tests for 'L1-norm' and 'cosine distance' metrics for kmeans. T…
…ests currently do not pass.
@mattilyra mattilyra Made tests for L1-norm and cosine distance pass for KMeans. 1981052
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment