{"id":15641829,"url":"https://github.com/stefan-it/capsnet-nlp","last_synced_at":"2025-10-13T07:06:22.981Z","repository":{"id":110973673,"uuid":"125908932","full_name":"stefan-it/capsnet-nlp","owner":"stefan-it","description":"CapsNet for NLP","archived":false,"fork":false,"pushed_at":"2019-01-12T10:09:24.000Z","size":22,"stargazers_count":67,"open_issues_count":2,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T09:15:10.662Z","etag":null,"topics":["capsnet","deep-learning","hinton","keras","natural-language-processing","tensorflow"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefan-it.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","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-03-19T19:22:00.000Z","updated_at":"2025-01-19T12:53:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"14ecda86-3218-4204-87b0-cac5eb4035ae","html_url":"https://github.com/stefan-it/capsnet-nlp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stefan-it/capsnet-nlp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefan-it%2Fcapsnet-nlp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefan-it%2Fcapsnet-nlp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefan-it%2Fcapsnet-nlp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefan-it%2Fcapsnet-nlp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefan-it","download_url":"https://codeload.github.com/stefan-it/capsnet-nlp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefan-it%2Fcapsnet-nlp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014104,"owners_count":26085459,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["capsnet","deep-learning","hinton","keras","natural-language-processing","tensorflow"],"created_at":"2024-10-03T11:46:08.811Z","updated_at":"2025-10-13T07:06:22.977Z","avatar_url":"https://github.com/stefan-it.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *CapsNet* for Natural Language Processing\n\n\u003e A capsule is a group of neurons whose activity vector represents the\n\u003e instantiation parameters of a specific type of entity such as an object or an\n\u003e object part.\n\nThis repository shows how to use a *CapsNet* architecture for Natural Language\nPrcoessing tasks like sentiment analysis.\n\n*Capsules* are introduced by Geoffrey Hinton. We use a *CapsNet*\nimplementation from 苏剑林 as git submodule. The implementation can be found\n[here](https://github.com/bojone/Capsule).\n\n## Related work\n\nHere are some papers where *capsules* and the *CapsNet* architecture are\nintroduced:\n\n| Paper                              | Authors                                         | Link\n| ---------------------------------- | ----------------------------------------------- | -------------------------------------------------------------\n| *Dynamic Routing Between Capsules* | Sara Sabour, Nicholas Frosst, Geoffrey E Hinton | [here](https://arxiv.org/abs/1710.09829)\n| *Matrix capsules with EM routing*  | Geoffrey E Hinton et al.                        | [here](https://openreview.net/forum?id=HJWLfGWRb)\n| *Transforming Auto-encoders*       | Geoffrey E. HintonAlex Krizhevsky, Sida D. Wang | [here](http://www.cs.toronto.edu/~fritz/absps/transauto6.pdf)\n\n## Submodules\n\nThe *CapsNet* implementation is included via git submodule. So the **first**\nstep after cloning *this* repository is to initialize the git submodules. This\ncan be done via:\n\n```bash\ngit submodule update --init --recursive\n```\n\n# *IMDB*\n\nWe use the *IMDB* dataset for sentiment analysis with *CapsNet*. We use a\nbidirectional GRU before the *capsnet* layer.\n\nThe training can be started with:\n\n```bash\npython3 main.py\n```\n\nIt takes several minutes per epoch. It is highly recommended to use a GPU for\ntraining. All experiments are done with a GTX 1060 (6GB).\n\n## Results\n\nThe following experiments are done on *IMDB* dataset:\n\n* Model a): we use a bidirectional GRU with a hidden size of 256. Number of\n  capsule is set to 10. Number of routings is set to 3.\n\n| Model | Best accuracy\n| ----- | -------------\n| a     | 88,98 %\n\n# Requirements\n\nA recent version of *Keras*, *TensorFlow* and *h5py* is needed. Only Python 3.x\nis currently supported.\n\n# Contact (Bugs, Feedback, Contribution and more)\n\nFor questions about the *capsnet-nlp* repository, please open an issue [here](https://github.com/stefan-it/capsnet-nlp/issues). \nIf you want to contribute to the project\nplease refer to the [Contributing](CONTRIBUTING.md) guide!\n\n# License\n\nTo respect the Free Software Movement and the enormous work of Dr. Richard Stallman\nthe software in this repository is released under the *GNU Affero General Public License*\nin version 3. More information can be found [here](https://www.gnu.org/licenses/licenses.html)\nand in `COPYING`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefan-it%2Fcapsnet-nlp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefan-it%2Fcapsnet-nlp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefan-it%2Fcapsnet-nlp/lists"}