Lurker News

Comments (491) 209 threads

Show all comments

Showing thread 11 of 209

avinassh5 replies#
K - means clustering, which I learned about recently.

For non-machine learning folks, this algorithms helps in grouping relevant items together. As a practical, using this algorithm you can segment your customers based on their purchase history and interests.
The actual algorithm is very simple, imagine a lot of points on the 2D plane and each of them represent customers, whom you want to segment/cluster. Now, chose random cluster points and assign those customers to these points, by their distance. That is, whichever customer is near to a point, it belongs to that. At the end of iteration, you have lots of customers assigned to each cluster. Now, for each cluster, take the mean of those customers and the move the cluster to this mean value. Slowly, the cluster points move to the center with all the customers surrounded, belonging to that cluster.
read more - https://en.wikipedia.org/wiki/K-means_clustering

jacknews1 reply#
I prefer mean-shift for it's simplicity, as it even creates it's own clusters.
n4r91 reply#
Could you explain what you mean by that a little more? I looked at the Clustering section of the Wikipedia page for Mean-Shift:

https://en.wikipedia.org/wiki/Mean_shift#Clustering
but I don't get how C and r are chosen, nor how the method is supposed to be "non-parametric" given that you need such parameters to begin with.
Also, how are you supposed to assign all points to separate clusters, and how would you determine how many clusters to use in the first place?
Having looked at the that page I also definitely don't think it's simpler than K-means!
Edit: This article gives a much more accessible descriptions than wikipedia:
https://spin.atomicobject.com/2015/05/26/mean-shift-clusteri...
To answer my own questions, the number of clusters is determined by the number of max points of the kernel density function, but the kernel bandwidth does have to be specified.

vanderZwan3 replies#
Thanks for not just looking for an answer to your own question but also sharing it!

> So how does mean shift come into the picture? Mean shift exploits this KDE idea by imagining what the points would do if they all climbed up hill to the nearest peak on the KDE surface. It does so by iteratively shifting each point uphill until it reaches a peak.
I wonder if this would still work with high-dimensional data. Distance and space start to act weird in higher dimensions, right?

Continue this thread — 3 replies

another-cuppa2 replies#
K-means is not an algorithm, it's a heuristic for an Np-hard problem.
wnkrshm1 reply#
Isn't a method that gives an approximate or best-fit estimate to a problem still an algorithm, if it terminates?
another-cuppa5 replies#
No. You can't prove that k-means does anything useful.

Continue this thread — 5 replies

n4r91 reply#
It is absolutely an algorithm in the sense of "a set of rules to be followed". I think you mean that it doesn't guarantee an optimal solution. That just means it's a heuristic algorithm, same as simulated annealing is a heuristic algorithm for solving optimisation problems.
another-cuppa4 replies#
Nope. An algorithm has to be effective. You can find pathological cases for k-means such that it will never converge on anything useful. So if you set your termination case to be convergence it will never terminate and if you don't then it will never be effective.
zaphar2 replies#
I think you might be in the minority in this opinion. Many algorithms have pathological cases but are still considered algorithms

Continue this thread — 2 replies

billfruit1 reply#
In that sense kmeans may be better referred to as a 'computational method' rather than an algorithm.

Continue this thread — 1 reply

skykooler3 replies#
BogoSort is an algorithm. Not a very good algorithm, but an algorithm nevertheless.

Continue this thread — 3 replies

n4r92 replies#
As far as I can tell you're only arguing against poor implementations of K-means. If you demand that the score strictly improves at each iteration then the algorithm must terminate.

Continue this thread — 2 replies

stevesimmons#
The scikit-learn page on clustering [1] is a really great way to see K-means and other algorithms side-by-side. The pictures really make it easy to see how all the algorithms perform on various data distributions.

[1] http://scikit-learn.org/stable/modules/clustering.html