Giter VIP home page Giter VIP logo

hyperim's Introduction

HyperIM

PyTorch implementation of Hyperbolic Interaction Model For Hierarchical Multi-Label Classification

Requirements

  • torch>=1.0.0
  • geoopt ($ pip install git+https://github.com/geoopt/geoopt.git)
  • numpy
  • scipy
  • pandas
  • tqdm

Instruction

Run HyperIM via

$ python HyperIM.py

or run EuclideanIM via

$ python EuclideanIM.py

Alternatively use the two Jupyter notebooks.

Data

X_train and X_test should be dense numpy array with shape (instance_num, word_num), y_train and y_test should be one-hot sparse scipy array with shape (instance_num, label_num). Sample data is provided in ./data/sample/.

The multi-label text classification datasets equipped with hierarchically structured labels (RCV1, Zhihu and WikiLSHTC) are publicly available.

Pre-trained embeddings

Hyperbolic word embeddings can be trained following Poincaré GloVe. Pre-trained word embeddings should have shape (vocab_size, embed_dim).

The label hierarchy can be embedded using the gensim implementation of the Poincaré embeddings, specified in Train and use Poincaré embeddings. Label embeddings should have shape (label_num, embed_dim). Note that the index of labels in the label embeddings should be consistent with y_train and y_test.

Use them accordingly in HyperIM.py and EuclideanIM.py.

Citation

If you find this code useful for your research, please cite the following paper in your publication:

@article{chen2019hyperbolic,
  title={Hyperbolic Interaction Model For Hierarchical Multi-Label Classification},
  author={Chen, Boli and Huang, Xin and Xiao, Lin and Cai, Zixin and Jing, Liping },
  journal={arXiv preprint arXiv:1905.10802},
  year={2019}
}

hyperim's People

Contributors

bcol23 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.