{"id":13936135,"url":"https://github.com/dongjun-Lee/text-classification-models-tf","last_synced_at":"2025-07-19T21:31:49.715Z","repository":{"id":96929226,"uuid":"141006273","full_name":"dongjun-Lee/text-classification-models-tf","owner":"dongjun-Lee","description":"Tensorflow implementations of Text Classification Models.","archived":false,"fork":false,"pushed_at":"2022-11-19T02:12:06.000Z","size":11,"stargazers_count":505,"open_issues_count":6,"forks_count":164,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-11-27T04:30:38.868Z","etag":null,"topics":["tensorflow","text-classification"],"latest_commit_sha":null,"homepage":null,"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/dongjun-Lee.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-15T07:11:07.000Z","updated_at":"2024-10-22T09:55:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"514b4e6f-6822-4fa3-9bbe-2eb2beb502e4","html_url":"https://github.com/dongjun-Lee/text-classification-models-tf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dongjun-Lee/text-classification-models-tf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongjun-Lee%2Ftext-classification-models-tf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongjun-Lee%2Ftext-classification-models-tf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongjun-Lee%2Ftext-classification-models-tf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongjun-Lee%2Ftext-classification-models-tf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dongjun-Lee","download_url":"https://codeload.github.com/dongjun-Lee/text-classification-models-tf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongjun-Lee%2Ftext-classification-models-tf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266019657,"owners_count":23864916,"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":["tensorflow","text-classification"],"created_at":"2024-08-07T23:02:24.680Z","updated_at":"2025-07-19T21:31:44.706Z","avatar_url":"https://github.com/dongjun-Lee.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Text Classification Models with Tensorflow\nTensorflow implementation of Text Classification Models.\n\nImplemented Models:\n\n1. Word-level CNN [[paper](https://arxiv.org/abs/1408.5882)]\n2. Character-level CNN [[paper](https://arxiv.org/abs/1509.01626)]\n3. Very Deep CNN [[paper](https://arxiv.org/abs/1606.01781)]\n4. Word-level Bidirectional RNN\n5. Attention-Based Bidirectional RNN [[paper](http://www.aclweb.org/anthology/P16-2034)]\n6. RCNN [[paper](https://www.aaai.org/ocs/index.php/AAAI/AAAI15/paper/download/9745/9552)]\n\nSemi-supervised text classification(Transfer learning) models are implemented at [[dongjun-Lee/transfer-learning-text-tf]](https://github.com/dongjun-Lee/transfer-learning-text-tf).\n\n\n## Requirements\n- Python3\n- Tensorflow\n- pip install -r requirements.txt\n\n\n## Usage\n\n### Train\nTo train classification models for dbpedia dataset,\n```\n$ python train.py --model=\"\u003cMODEL\u003e\"\n```\n(\\\u003cModel\u003e: word_cnn | char_cnn | vd_cnn | word_rnn | att_rnn | rcnn)\n\n### Test\nTo test classification accuracy for test data after training,\n```\n$ python test.py --model=\"\u003cTRAINED_MODEL\u003e\"\n```\n\n\n### Sample Test Results\nTrained and tested with dbpedia dataset. (```dbpedia_csv/train.csv```, ```dbpedia_csv/test.csv```)\n\nModel    | WordCNN    | CharCNN   | VDCNN    | WordRNN   | AttentionRNN | RCNN    | *SA-LSTM | *LM-LSTM |\n:---:    | :---:      | :---:     | :---:    | :---:     | :---:        | :---:   | :---:    | :---:    |\nAccuracy | 98.42%     | 98.05%    | 97.60%   | 98.57%     | 98.61%      | 98.68% | 98.88%    | 98.86%   |\n\n(SA-LSTM and LM-LSTM are implemented at [[dongjun-Lee/transfer-learning-text-tf]](https://github.com/dongjun-Lee/transfer-learning-text-tf).)\n\n\n## Models\n\n### 1. Word-level CNN\nImplementation of [Convolutional Neural Networks for Sentence Classification](https://arxiv.org/abs/1408.5882).\n\n\u003cimg width=\"600\" src=\"https://user-images.githubusercontent.com/6512394/41590312-b1c28fca-73f1-11e8-9123-e26a03853cc7.png\"\u003e\n\n\n### 2. Char-level CNN\nImplementation of [Character-level Convolutional Networks for Text Classification](https://arxiv.org/abs/1509.01626).\n\n\u003cimg width=\"600\" src=\"https://user-images.githubusercontent.com/6512394/41590359-c6c94f8a-73f1-11e8-8bda-976ddf09e817.png\"\u003e\n\n\n### 3. Very Deep CNN (VDCNN)\nImplementation of [Very Deep Convolutional Networks for Text Classification](https://arxiv.org/abs/1606.01781).\n\n\u003cimg height=\"600\" src=\"https://user-images.githubusercontent.com/6512394/41590802-e68f71cc-73f2-11e8-88c6-4bf84bf3410e.png\"\u003e\n\n### 4. Word-level Bi-RNN\nBi-directional RNN for Text Classification.\n\n1. Embedding layer\n2. Bidirectional RNN layer\n3. Concat all the outputs from RNN layer\n4. Fully-connected layer\n\n\n### 5. Attention-Based Bi-RNN\nImplementation of [Attention-Based Bidirectional Long Short-Term Memory Networks for Relation Classification](http://www.aclweb.org/anthology/P16-2034).\n\n\u003cimg width=\"600\" src=\"https://user-images.githubusercontent.com/6512394/41424160-42520358-7038-11e8-8db0-859346a1fa3a.PNG\"\u003e\n\n### 6. RCNN\nImplementation of [Recurrent Convolutional Neural Networks for Text Classification](https://www.aaai.org/ocs/index.php/AAAI/AAAI15/paper/download/9745/9552).\n\n\u003cimg width=\"600\" src=\"https://user-images.githubusercontent.com/6512394/42731530-c4ff3c34-8849-11e8-89fb-a49743255b0a.png\"\u003e\n\n## References\n- [dennybritz/cnn-text-classification-tf](https://github.com/dennybritz/cnn-text-classification-tf)\n- [zonetrooper32/VDCNN](https://github.com/zonetrooper32/VDCNN)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdongjun-Lee%2Ftext-classification-models-tf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdongjun-Lee%2Ftext-classification-models-tf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdongjun-Lee%2Ftext-classification-models-tf/lists"}