{"id":21874731,"url":"https://github.com/longxingtan/text-classification","last_synced_at":"2025-04-15T01:25:42.640Z","repository":{"id":35951631,"uuid":"163815772","full_name":"LongxingTan/Text-classification","owner":"LongxingTan","description":"Text classification in Tensorflow1.x","archived":false,"fork":false,"pushed_at":"2022-10-24T01:50:19.000Z","size":1492,"stargazers_count":24,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T13:21:16.022Z","etag":null,"topics":["attention","bert","capsule-network","nlp","python","tensorflow","text-classification"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LongxingTan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-02T08:41:00.000Z","updated_at":"2025-01-16T12:50:49.000Z","dependencies_parsed_at":"2023-01-16T09:43:29.470Z","dependency_job_id":null,"html_url":"https://github.com/LongxingTan/Text-classification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LongxingTan%2FText-classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LongxingTan%2FText-classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LongxingTan%2FText-classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LongxingTan%2FText-classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LongxingTan","download_url":"https://codeload.github.com/LongxingTan/Text-classification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248987355,"owners_count":21194209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attention","bert","capsule-network","nlp","python","tensorflow","text-classification"],"created_at":"2024-11-28T07:13:12.110Z","updated_at":"2025-04-15T01:25:42.612Z","avatar_url":"https://github.com/LongxingTan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Text_classification\r\n\r\n## Overview\r\nThe repository implements the common algorithms for multi-class text classification.\r\nNote that it's just prototypes for experimental purposes only\r\n\r\n- Word or char level representation: chi-square+tfidf, word2vec, glove, fasttext, elmo, bert, or concated one\r\n- Model: CNN, BiLSTM, Self-attention,C-LSTM, RCNN, Capsule, HAN, SVM, XGBoost\r\n- Multi task learning: for more than one multi_labels\r\n\r\n## Dependencies\n```pip install -r requirements.txt```\r\n- Python 3.6\r\n- Tensorflow 1.12.0\r\n\r\n## Usage\r\n`python run_classifier.py`\r\n- in config.py, set the  `new_data=True`, -\u003e  generate the `./data/*.tf_record` -\u003e  utilize config.py parameters\r\n- in config.py, set the  `new_data=False`, -\u003e  utilize the data from `./data/*.tf_record` -\u003e  utilize config.json parameters\r\n\r\n## Pretrained\r\n- [word2vec Chinese pretrained download](https://github.com/Embedding/Chinese-Word-Vectors)\r\n- [fasttext Chinese pretrained download](https://fasttext.cc/docs/en/crawl-vectors.html)\r\n- [bert Chinese pretrained download from google](https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip)\n- tips: make sure the text use the similar preprocessing trick like segmentation as the pretrained material\n- create a word2vec pretrained model [reference](https://github.com/LongxingTan/Machine_learning_python/tree/master/nlp_embedding)\r\n\r\n## Purpose\r\n- The classification is used to clarify the damaged part and damage type from vehicles comments\r\n\r\n## Evaluation\r\n- Check in tensorboard: `tensorboard --logdir=./outputs`\r\n- Due to we have too many categories of labels (ca. 500 class for 100,000 examples), and they are not equally important, so we don’t use Macro- evaluation. And the Micro- precision/recall/F1 is the same for multi-label classification. So we check the accuracy and weighted F1.\r\n\r\n## Ignored property\r\n- Sometimes in one sample, more than one label are valid\r\n- Some labels have hierarchy relationship\r\n- imbalance issue: weighted loss, data argument, anomaly detection, upsampling and downsampling\n\n## Todo\n- Multi-task learning\n- Multi-label classification\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongxingtan%2Ftext-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flongxingtan%2Ftext-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongxingtan%2Ftext-classification/lists"}