{"id":18860220,"url":"https://github.com/modelzoo/textclassification","last_synced_at":"2025-07-30T21:37:36.782Z","repository":{"id":86738427,"uuid":"168858211","full_name":"ModelZoo/TextClassification","owner":"ModelZoo","description":"Text Classification Implemented by ModelZoo","archived":false,"fork":false,"pushed_at":"2019-02-02T18:06:16.000Z","size":7248,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-30T20:17:52.544Z","etag":null,"topics":[],"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/ModelZoo.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":"2019-02-02T17:34:34.000Z","updated_at":"2019-02-02T18:06:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ba26577-eef0-487e-9fbe-54d5ec385692","html_url":"https://github.com/ModelZoo/TextClassification","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/ModelZoo%2FTextClassification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelZoo%2FTextClassification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelZoo%2FTextClassification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelZoo%2FTextClassification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ModelZoo","download_url":"https://codeload.github.com/ModelZoo/TextClassification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239800487,"owners_count":19699127,"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":[],"created_at":"2024-11-08T04:22:41.067Z","updated_at":"2025-02-20T08:15:29.377Z","avatar_url":"https://github.com/ModelZoo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TextClassification\n\nTextClassification Model implemented by [ModelZoo](https://github.com/ModelZoo/ModelZoo). We can use this model to get the positive or negative emotion of movie comments.\n\n## Installation\n\nFirstly you need to clone this repository and install dependencies with pip:\n\n```\npip3 install -r requirements.txt\n```\n\n## Dataset\n\nWe use IMDB dataset for example.\n\n## Usage\n\nWe can run this model like this:\n\n```\npython3 train.py\n```\n\nOutputs like this:\n\n```\nEpoch 1/50\n624/625 [============================\u003e.] - ETA: 0s - loss: 0.4417 - acc: 0.8072\nEpoch 00001: saving model to checkpoints/model.ckpt\n625/625 [==============================] - 22s 35ms/step - loss: 0.4413 - acc: 0.8074 - val_loss: 0.2309 - val_acc: 0.8750\nEpoch 2/50\n623/625 [============================\u003e.] - ETA: 0s - loss: 0.2265 - acc: 0.9138 Epoch 00002: saving model to checkpoints/model.ckpt\nEpoch 00002: saving model to checkpoints/model.ckpt-2\n625/625 [==============================] - 24s 39ms/step - loss: 0.2264 - acc: 0.9139 - val_loss: 0.2734 - val_acc: 0.9062\nEpoch 3/50\n623/625 [============================\u003e.] - ETA: 0s - loss: 0.1685 - acc: 0.9382\nEpoch 00003: saving model to checkpoints/model.ckpt\n625/625 [==============================] - 19s 31ms/step - loss: 0.1685 - acc: 0.9383 - val_loss: 0.2043 - val_acc: 0.8750\nEpoch 4/50\n622/625 [============================\u003e.] - ETA: 0s - loss: 0.1314 - acc: 0.9549\nEpoch 00004: saving model to checkpoints/model.ckpt\nEpoch 00004: saving model to checkpoints/model.ckpt-4\n625/625 [==============================] - 19s 30ms/step - loss: 0.1313 - acc: 0.9550 - val_loss: 0.6623 - val_acc: 0.7812\n```\n\nWhen finished, we can find two folders generated named `checkpoints` and `events`.\n\nGo to `events` and run TensorBoard:\n\n```\ncd events\ntensorboard --logdir=.\n```\n\nTensorBoard like this:\n\n![](https://ws3.sinaimg.cn/large/006tNc79ly1fzslrtg6oyj31f70u0wgy.jpg)\n\nThere are training batch loss, epoch loss, eval loss.\n\nAnd also we can find checkpoints in `checkpoints` dir.\n\nIt saved the best model named `model.ckpt` according to eval score, and it also saved checkpoints every 2 epochs.\n\nNext we can use the best model to infer some results, run `infer.py`:\n\nOutput like this:\n\n```\nText: \u003cSTART\u003e this is a crummy film a \u003cUNK\u003e to a genre of surprise ending movies and a genre that has been done so much better before the plot \u003cUNK\u003e along with a predictable ending yawn the characters are unlikeable and some are so unlikeable they are almost unwatchable matt dillon a fine intense actor is totally miscast here and is stiff and mannered the others are forgettable much of the dialog is \u003cUNK\u003e again a \u003cUNK\u003e trying to be witty i wouldn't hire the screenwriter to write my \u003cUNK\u003e list yes it's that bad \u003cUNK\u003e from misogynistic to just plain gross as in beyond frat house gross with so much real talent out there i'm really surprised this movie ever got made it shows the total lack of imagination of the office suits\nComment: 0\n====================\nText: \u003cSTART\u003e i rented this film from because of the cover and title sounded intriguing this movie suffered because of the writing it needed more suspense the monsters needed more face time we needed them to have some sort of special power and definitely more oh sh moments the photography didn't bother me except for the scene where a re \u003cUNK\u003e blows up there were too many close ups but other than that the movie seemed to drag and the heroes didn't really work for their freedom overall i would say everyone put in a lot of time even the writers but this movie is definitely a below average rent br br there are definitely better picks i would recommend 1 or 2 over this pick\nComment: 1\n```\n\nThen we can get the emotion comment according to the source text.\n\nresult `1` means positive, result `0` means negative.\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodelzoo%2Ftextclassification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodelzoo%2Ftextclassification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodelzoo%2Ftextclassification/lists"}