MCPcopy Index your code
hub / github.com/chengsen/PyTorch_TextGCN

github.com/chengsen/PyTorch_TextGCN @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
71 symbols 185 edges 6 files 14 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Graph Convolutional Networks for Text Classification in PyTorch

PyTorch 1.6 and Python 3.7 implementation of Graph Convolutional Networks for Text Classification [1].

Tested on the 20NG/R8/R52/Ohsumed/MR data set, the code on this repository can achieve the effect of the paper.

Benchmark

dataset 20NG R8 R52 Ohsumed MR
TextGCN(official) 0.8634 0.9707 0.9356 0.6836 0.7674
This repo. 0.8618 0.9704 0.9354 0.6827 0.7643

NOTE: The result of the experiment is to repeat the run 10 times, and then take the average of accuracy.

Requirements

  • fastai==2.0.15
  • PyTorch==1.6.0
  • scipy==1.5.2
  • pandas==1.0.1
  • spacy==2.3.1
  • nltk==3.5
  • prettytable==1.0.0
  • numpy==1.18.5
  • networkx==2.5
  • tqdm==4.49.0
  • scikit_learn==0.23.2

Usage

  1. Process the data first, run data_processor.py (Already done)
  2. Generate graph, run build_graph.py (Already done)
  3. Training model, run trainer.py

References

[1] Yao, L. , Mao, C. , & Luo, Y. . (2018). Graph convolutional networks for text classification.

Core symbols most depended-on inside this repo

print_graph_detail
called by 3
utils.py
save
called by 2
build_graph.py
clean_str
called by 2
data_processor.py
remove_stopword
called by 2
data_processor.py
log
called by 2
utils.py
forward
called by 2
layer.py
val
called by 2
trainer.py
get_window
called by 1
build_graph.py

Shape

Method 42
Function 19
Class 10

Languages

Python100%

Modules by API surface

utils.py25 symbols
trainer.py14 symbols
data_processor.py13 symbols
build_graph.py11 symbols
layer.py8 symbols

For agents

$ claude mcp add PyTorch_TextGCN \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact