Classify users by the pages they liked

I have a data set of users, and a list of pages each users liked.

My goal is to derive k classes of users.

The first thing that comes to mind are bag-of-words models

The way I see it, there are 2 approaches:

Bayesian

I was thinking of applying LDA and get a posterior probability of classes for each user.

However, LDA is usually applied to topic classification of documents. In the topic case, a word can be repeated several times in a document. And in my case, a page can be liked only once by a user.

Another option is to apply pLSA, which is ok since I know the list of possible pages in advance

Factorizing the User-Page Matrix

A different approach would be apply some factor analysis method on the user-page matrix, such as SVD or LFM

From your experience, what algorithms work well for short documents ?

• To clarify: Are you simply trying to split the users into K classes? – user75138 Sep 14 '15 at 1:40
• yes, relying only on the pages they liked – Uri Goren Sep 14 '15 at 8:09

You could try k means. I wrote some code (that's too long to paste here) after seeing this yesterday that will classify users into k clusters given a json file like this of pages they liked. The initial mean selection could be improved upon but with some altering you may find it useful. Just run it with data.json in the same directory.

Larger data sets work better so here is the script I used to generate data.json. You can alter it to create any length dataset of user page likes to input into kmeans.py.

Hope this helps.

I don't think LDA is an appropriate method for your problem. You are trying to find $k$ clusters in the space of user $preferences$.

A simpler, and probably effective approach, would be to represent each user's preferences (i.e., which pages they liked), as vectors with binary components and then cluster them according to their vectors using k-means.

Now, if you are really trying to correlate a linkage between document content and user preference vectors, then I'd suggest fitting a logistic model, with the document's term frequency vector as input and the preference of user $i$ for that document as the binary output.

If you think that the preferences themselves are correlated, then you could perform PCA on your preference matrix (or SVD) and then fit logistic models to the orthogonal components (which are defined to be independent).

I hope this post is useful:

These articles discusses code to find the ideal number of clusters:

www.r-statistics.com/2013/08/k-means-clustering-from-r-in-action/

www.inside-r.org/packages/cran/useful/docs/PlotHartigan I used the above library on a project before.

Once you have your representative topics, you could slot the users using these classification methods

Cosine similarly:

https://en.wikipedia.org/wiki/Collaborative_filtering

https://en.wikipedia.org/wiki/Winnow_(algorithm)

And good old Niave Bayes classification.

Since you already looked into LDA,

It is worth to mention that extensive research was done on topic-modeling Twitter posts,

For example: here

The "twitter lda" model can suit your needs since, in twitter the amount of words is limited, as do, I assume the number of pages a user likes.

And also in twitter, models can incorporate additional details about the author, that may come up useful in your research as well