Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple Python implementation of collaborative topic modeling?

I came across these 2 papers which combined collaborative filtering (Matrix factorization) and Topic modelling (LDA) to recommend users similar articles/posts based on topic terms of post/articles that users are interested in.

The papers (in PDF) are: "Collaborative Topic Modeling for Recommending Scientific Articles" and "Collaborative Topic Modeling for Recommending GitHub Repositories"

The new algorithm is called collaborative topic regression. I was hoping to find some python code that implemented this but to no avail. This might be a long shot but can someone show a simple python example?

like image 472
jxn Avatar asked Aug 25 '15 23:08

jxn


People also ask

How does LDA work in Python?

Linear Discriminant Analysis, or LDA for short, is a classification machine learning algorithm. It works by calculating summary statistics for the input features by class label, such as the mean and standard deviation. These statistics represent the model learned from the training data.

What is topic Modelling example?

Topic modeling is a type of statistical modeling for discovering the abstract “topics” that occur in a collection of documents. Latent Dirichlet Allocation (LDA) is an example of topic model and is used to classify text in a document to a particular topic.

What is topic Modelling in Python?

Topic Modelling is a technique to extract hidden topics from large volumes of text. The technique I will be introducing is categorized as an unsupervised machine learning algorithm. The algorithm's name is Latent Dirichlet Allocation (LDA) and is part of Python's Gensim package. LDA was first developed by Blei et al.


Video Answer


1 Answers

This should get you started (although not sure why this hasn't been posted yet): https://github.com/arongdari/python-topic-model

More specifically: https://github.com/arongdari/python-topic-model/blob/master/ptm/collabotm.py

class CollaborativeTopicModel:     """     Wang, Chong, and David M. Blei. "Collaborative topic                                  modeling for recommending scientific articles."     Proceedings of the 17th ACM SIGKDD international conference on Knowledge                                 discovery and data mining. ACM, 2011.     Attributes     ----------     n_item: int         number of items     n_user: int         number of users     R: ndarray, shape (n_user, n_item)         user x item rating matrix     """ 

Looks nice and straightforward. I still suggest at least looking at gensim. Radim has done a fantastic job of optimizing that software very well.

like image 150
Eugene Avatar answered Oct 14 '22 04:10

Eugene