Code Monkey home page Code Monkey logo

hsbm_topicmodel's Introduction

hSBM_Topicmodel

A tutorial for topic-modeling with hierarchical stochastic blockmodels using graph-tool.

Data

The corpus is saved in corpus.txt, where each line is a separate doc with words separated by whitespace. Optionally, we can provide a file with titles for the documents in titles.txt

Setup

Install graph-tool

We use the graph-tool package for finding topical structure in the word-document networks.

  • see the installation-instructions, where you will find packages for linux, etc.
  • an alternative for linux is to install via a conda-environment, see here

Get Jupyter notebook

In order to execture the tutorial-notebook, install jupyter, e.g.

pip install jupyter

Get hSBM-TopicModel repository

In order to do topic modeling with stochastic block models we need to get the code from the repositroy:

git clone https://github.com/martingerlach/hSBM_Topicmodel.git

Run the code

Start jupyter notebooks

jupter notebook

then select the 'TopSBM-tutorial'-notebook.

It will guide you through the different steps to do topic modeling with stochastic block models:

  • How to construct the word-document network from a corpus of text

  • How to fit the stochastic block model to the word-document network

  • How to extract the topics from the fitted model, e.g.

    • the most important words for each topic
    • the clustering of documents
    • the topic mixtures for each document
  • How to visualize the topical structure, in particular the hierarchy of topics

hsbm_topicmodel's People

Contributors

martingerlach avatar nstrayer avatar count0 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.