Giter Site home page Giter Site logo

1429904852 / lcn_capsule Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 156 KB

[TASLP 2023] Label-correction Capsule Network for Hierarchical Text Classification

Home Page: https://ieeexplore.ieee.org/document/10149184?source=authoralert

License: Apache License 2.0

Python 87.46% Shell 0.07% Jupyter Notebook 12.47%

lcn_capsule's Introduction

Label-correction Capsule Network for Hierarchical Text Classification

Code and data for "Label-correction Capsule Network for Hierarchical Text Classification" (TASLP 2023)


Requirements

  • tensorflow>=1.9
  • python>=2.7

Hypermeters

  • phase
    • hierarchical_preprocess(data process)
    • train, test(encoder=BiLSTM)
    • bert, bert_test(encoder=BERT)
  • dataset
  • model_type
  • batch_size
  • embedding_file_path

Usage

Data process

  • This is optional, because I have provided the pre-processed data under the folder named "data/data_name/hierarchical_processed/"(mainly generate .npy file)
python main.py --phase="hierarchical_preprocess" --dataset="DBpedia" --embedding_file_path="DB_embedding.txt"

we first use BiLSTM encode to verify the motivation of modal.

Training for BiLSTM

  • This is the training code of tuning parameters on the dev set, you can change hyperparameter to select different dataset or model_type.
sh run_dbpedia.sh
or
python main.py --phase="train" --dataset="DBpedia" --model_type="HAN_capsule_overrall" --batch_size=64 --n_class_1=9 --n_class_2=70 --n_class_3=219 --embedding_file_path='DB_embedding.txt' --saver_checkpoint='HAN_capsule_overrall'

Testing for BiLSTM

  • After training the model, the following code is used for directly loading the trained model and testing it on the test set:
python main.py --phase="test" --dataset="DBpedia" --model_type="HAN_capsule_overrall" --batch_size=64 --n_class_1=9 --n_class_2=70 --n_class_3=219 --embedding_file_path='DB_embedding.txt' --saver_checkpoint='HAN_capsule_overrall'

after that, we also use BERT encode to verify the scalability of our model.

Training for BERT

  • For example, you can use the following command to fine-tune Bert on the HTC task:
sh run_bert_dbpedia.sh
or
python main.py --phase="bert" --config_path="src/bert_classifier/config/dbpedia_config.json"

Testing for BERT

  • After training the model, you can use the following command to test Bert on the HTC task:
python main.py --phase="bert_test" --config_path="src/bert_classifier/config/dbpedia_config.json"

If the code and data are used in your research, please cite the paper:

@ARTICLE{10149184,
  author={Zhao, Fei and Wu, Zhen and He, Liang and Dai, Xin-Yu},
  journal={IEEE/ACM Transactions on Audio, Speech, and Language Processing}, 
  title={Label-Correction Capsule Network for Hierarchical Text Classification}, 
  year={2023},
  volume={31},
  number={},
  pages={2158-2168},
  doi={10.1109/TASLP.2023.3282099}}

lcn_capsule's People

Contributors

1429904852 avatar

Watchers

Kostas Georgiou avatar  avatar

Forkers

nibuhao

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.