Code Monkey home page Code Monkey logo

graphbtm's Introduction

GraphBTM

This repository contains the code for ourl EMNLP 2018 paper "GraphBTM: Graph Enhanced Autoencoded Variational Inference for Biterm Topic Model", you can find here.

Some code are based on the pytorch implementation of AVITM: https://github.com/hyqneuron/pytorch-avitm The Topic Coherence Evaluation is from: https://github.com/jhlau/topic_interpretability Thanks for sharing code!

Requirements

  • python 3.6
  • pytorch 0.4
  • numpy
  • python 2.7 for topic coherence evaluation

How to use

$ python pytorch_run.py --start

It may take some time to generate the biterms (it's too large to upload the pickle, so I upload the original files). It will generate the top 10 words in each topic after each epoch in 'topic_interpretability/data/topics_20news.txt', and you can use the code in the topic_interpretability folder:

$ ./run-oc.sh

If you find the code helpful, please kindly cite the paper:

> @InProceedings{D18-1495,
  author = 	"Zhu, Qile and Feng, Zheng and Li, Xiaolin",
  title = 	"GraphBTM: Graph Enhanced Autoencoded Variational Inference for Biterm Topic Model",
  booktitle = 	"Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing",
  year = 	"2018",
  publisher = 	"Association for Computational Linguistics",
  pages = 	"4663--4672",
  location = 	"Brussels, Belgium",
  url = 	"http://aclweb.org/anthology/D18-1495"
}

graphbtm's People

Contributors

valdersoul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

graphbtm's Issues

the vocab size of samle dataset

the sample dataset 20news takes a small vocabulary size of 1995, therefore, the adj becomes a 1995*1995 tensor. But if I make a larger vocabulary size, the adj matrix will be very big I couldn't be sure whether it will work.

Run the code without GPU

Hi, I tried to run your code without GPU and it asked for GPU.
Any suggestion? Thanks.

python pytorch_run.py --start --nogpu
loading biterms
Data Loaded
11258
start training
Traceback (most recent call last):
  File "pytorch_run.py", line 243, in <module>
    train(dataset)
  File "pytorch_run.py", line 157, in train
    biterm = torch.FloatTensor(biterm).float().cuda()
  File "/local/tcao/topic_modeling/GraphBTM/.env/lib/python3.6/site-packages/torch/cuda/__init__.py", line 161, in _lazy_init
    _check_driver()
  File "/local/tcao/topic_modeling/GraphBTM/.env/lib/python3.6/site-packages/torch/cuda/__init__.py", line 82, in _check_driver
    http://www.nvidia.com/Download/index.aspx""")
AssertionError:
Found no NVIDIA driver on your system. Please check that you
have an NVIDIA GPU and installed a driver from
http://www.nvidia.com/Download/index.aspx

Apply your code on a new corpus

I couldn't find instruction to generate the following files for a new corpus.
test.txt.npy, train.txt.npy, valid.txt.npy, vocab.pkl
Regarding the new corpus, would it be sufficient if I supply the text its text in data/20news_clean/corpus.txt?

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.