Coder Social home page Coder Social logo

graph-based-tc's Introduction

Graph-Based-TC

Graph-based framework for text classification

This is the code for the paper "Fusing Document, Collection and Label Graph-based Representations with Word Embeddings for Text Classification", presented at the TextGraphs workshop, NAACL 2018, New Orleans, USA. Our paper got the Best Paper Award!

Datasets

Our implementation includes 6 datasets: 20newsgroups, IMDB, WebKb, Reuters, Subjectivity and Amazon. We use the fetch_20newsgroups built-in python to get the 20newsgroup dataset. For the IMDB dataset, you can download it here. We add all remaining datasets here, due to GitHub size limits.

Files ending with main.py contain tf and tf-idf, and files ending with gow.py contain the tw, tw-idf, tw-icw and tw-icw-lw methods.

Parameters

Inside each file there are several parameters to set in order to get the result of the desired method.

parameters for main.py files

  • bag_of_words: use our tf-idf or the tf-idf vectorizer(scikit-learn)
  • ngrams_par: the number of ngrams
  • idf_bool: use idf or not

parameters for gow.py files

  • idf_pars: {"no","idf","icw”,”icw-lw”}, "no" for tw method, "idf" for tw-idf, "icw" for tw-icw, “icw-lw” for tw-icw-lw
  • sliding_window: the parameter for creating edges between words. 2 is for connecting only to the next word
  • centrality_par: the centrality metric which we use for term weighting (e.g. weighted_degree_centrality for weighted w2v version)
  • centrality_col_par: the centrality metric which we use for the collection graph

Example

For the WebKb dataset you go in the example/:

  • for tf run: webkb_main.py with parameter idf_bool = False
  • for tf-idf run: python webkb_main.py with parameter idf_bool = True
  • for tw with degree centrality run: python webkb_gow.py with parameter idf_par="no"
  • for tw-idf with degree centrality run: python webkb_gow.py with parameter idf_par="idf"
  • for tw-icw with degree centrality on both tw and icw run: python webkb_gow.py with parameter idf_par="icw"
  • for tf-icw with degree centrality on icw run: python webkb_gow.py with parameter idf_par="tf-icw"
  • for tw-icw-lw with degree centrality on both tw,icw and lw run: python webkb_gow.py with parameter idf_par="icw-lw"

Citation

Please cite using the following BibTeX entry if you use our code (same with Google Scholar):

@inproceedings{skianis2018fusing,
    title={Fusing Document, Collection and Label Graph-based Representations with Word Embeddings for Text Classification},
    author={Skianis, Konstantinos and Malliaros, Fragkiskos and Vazirgiannis, Michalis},
    booktitle={Proceedings of the Twelfth Workshop on Graph-Based Methods for Natural Language Processing (TextGraphs-12)},
    pages={49--58},
    year={2018}
}

graph-based-tc's People

Contributors

y3nk0 avatar

Watchers

James Cloos avatar Luís Gonçalves 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.