TF-IDF implementations in python - python

What are the standard tf-idf implementations/api available in python? I've come across the one in nltk. I want to know the other libraries that provide this feature.

there is a package called scikit which calculates tf-idf scores.
you can refer to my answer to this question
Python: tf-idf-cosine: to find document similarity
and also see the question code from this. Thankz.

Try the libraries which implements TF-IDF algorithm in python.
http://code.google.com/p/tfidf/
https://github.com/hrs/python-tf-idf

Unfortunately, questions asking for a tool or library are offtopic on SO. There are lot of machine learning libraries implementing tfidf. Two most comprehensive of them besides mentioned ntlk in my view are sklearn and gensim.

Related

Topic modeling on short texts Python

I want to do topic modeling on short texts. I did some research on LDA and found that it doesn't go well with short texts. What methods would be better and do they have Python implementations?
You can try Short Text Topic Modelling (refer to this https://www.groundai.com/project/sttm-a-tool-for-short-text-topic-modeling/1) (code available at https://github.com/qiang2100/STTM) . It combine state-of-the-art algorithms and traditional topics modelling for long text which can conveniently be used for short text.
For more specialised libraries, try lda2vec-tf, which combines word vectors with LDA topic vectors. It is branched from the original lda2vec and improved upon and gives better results than the original library.
Besides GSDM, there is also biterm implemented in python for short text topic modeling.
The only Python implementation of short text topic modeling is GSDMM. Unfortunately, most of the others are written on Java.
Here's a very fast and easy to use implementation of GSDMM that can be used in Python that I wrote recently: https://github.com/centre-for-humanities-computing/tweetopic
I found the existing implementations quite lacking, especially performance-wise, this one usually performs about 60x times faster than gsdmm, is much better documented, and is fully compatible with sklearn.

Creating text-clusters that contain similar text

Recently I had worked on image clustering which found similar images and grouped them together. I had used python's skimage module to calculate SSIM and then cluster all images based on some threshold that was decided.
I want to do similar for the text. I want to create automatic clusters containing similar text. For example, cluster-1 could have all text that represents working mothers, cluster-2 could have all text representing people talking about food and so on. I understand this has to be unsupervised learning. Do we have similar python module's that could help achieve this task? I also checked out google's tensorflow to see if I could get something from it but did not find anything relating to text clustering in its documentation.
There are numerous ways you can approach the task. In most cases the clustering algorithms are very similar to image clustering but what you need to define is the distance metric - in this case semantic similarity metric of some kind.
For this purpose you can use the approaches I list in another question around the topic of semantic similarity (even if a bit more detailed).
The one additional approach worth mentioning is 'automatic clustering' provided by topical modelling tools like LSA which you can run fairly easy using gensim package.

Which model to use when mixed-effects, random-effects added regression is needed

So mixed-effects regression model is used when I believe that there is dependency with a particular group of a feature. I've attached the Wiki link because it explains better than me. (https://en.wikipedia.org/wiki/Mixed_model)
Although I believe that there are many occasions in which we need to consider the mixed-effects, there aren't too many modules that support this.
R has lme4 and Python seems to have a similar module, but they are both statistic driven; they do not use the cost function algorithm such as gradient boosting.
In Machine Learning setting, how would you handle the situation that you need to consider mixed-effects? Are there any other models that can handle longitudinal data with mixed-effects(random-effects)?
(R seems to have a package that supports mixed-effects: https://rd.springer.com/article/10.1007%2Fs10994-011-5258-3
But I am looking for a Python solution.
There are, at least, two ways to handle longitudinal data with mixed-effects in Python:
StatsModel for linear mixed effects;
MERF for mixed effects random forest.
If you go for StatsModel, I'd recommend you to do some of the examples provided here. If you go for MERF, I'd say that the best starting point is here.
I hope it helps!

Python based SVM library

Is there a Python based library providing an SVM implementation with a GPL or any other opensource license? I have come across a few that provide an SVM wrapper for the SVM logic encoded in C, but none that are coded entirely in Python.
Regards,
Mandar
libsvm has Python bindings.
Edit
Googling found PyML, but I haven't used it.
You might want to check out this link, it has a big collection of machine learning software, it lists 50+ libraries that have been written in Python:
http://mloss.org/software/language/python/

pareto ranking using Pyevolve

I am currently using Pyevolve package to solve some Genetic Algorithms problems. I am wondering is there any examples using Pareto ranking in Pyevolve package, since I have multi evaluation functions.
If not exists, could you plz provides some pseudo code of Pareto ranking algorithms. I want to implement it by myself.
Thank you!!
Based on the last release documentation there effectively doesn't seem to be any Pareto ranking package in Pyevolve.
If you want to implement it yourself, you should check NSGA-II which is one most well known and best working algorithm for multi-objective optimization. The original article, containing pseudocode, can be found here : http://sci2s.ugr.es/docencia/doctobio/2002-6-2-DEB-NSGA-II.pdf
If you want to develop multi-objective genetic algorithms in Python and since Pyevolve development is quite moribund, I would recommend you to check out a more versatile framework named DEAP : http://deap.googlecode.com/. The framework already includes everything you need to do multi-objectives GAs, and provides many examples of how this can be done (NSGA-II is already implemented in DEAP). The transition from Pyevolve should be easy as the documentation is quite complete. You can also get in touch with the developers, they answer questions very quickly.

Categories

Resources