Skip to content

christianrfg/tm_metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Topic Modeling Quality Metrics

This repository contains a Python 3 implementation of topic modeling quality metrics. All metrics are based on the Topic Quality Metrics Based on Distributed Word Representations paper. There are implementations of the following metrics: Coherence, TFIDF-Coherence, PMI/NPMI, LCP and Word2Vec metrics (Cosine Distance, L1 Distance, L2 Distance, Coordinate Distance).

With this metrics you can measure the quality of the topics generated by any topic modeling approach, all that you need is the documents used to generate the topics. For the Word2Vec metrics you'll also need a Word Embedding to extract the vectors.

Installing

Clone this repository in your machine and execute the installation with pip.

Dependencies

In following he've the packages needed in the library:

  • numpy>=1.14.6
  • scikit-learn>=0.20.3
  • scipy>=1.2.1
  • gensim>=3.8.1

User Installation

You can install the tm_metric library with pip:

pip install -U .

Jupyter Example

In the Exemple of Quality Metrics in the 20 News Group Dataset we have a example with the usage of the package (tm_metrics).

In the notebook we use the 20 News Group dataset and the NMF (for topic modeling). We also use the gensim to create a Word Embedding, that is necessary to the Word2Vec metrics.

In the notebook we can see the evaluation of the topics generated, where we use each metric implemented by the tm_metrics package.

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details