{"id":33120086,"url":"https://github.com/YJiangcm/SST-2-sentiment-analysis","last_synced_at":"2025-11-19T22:01:15.704Z","repository":{"id":41444685,"uuid":"313551401","full_name":"YJiangcm/SST-2-sentiment-analysis","owner":"YJiangcm","description":"Use BiLSTM_attention, BERT, ALBERT, RoBERTa, XLNet model to classify the SST-2 data set based on pytorch","archived":false,"fork":false,"pushed_at":"2020-12-09T19:40:00.000Z","size":541,"stargazers_count":67,"open_issues_count":2,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-10-20T23:56:20.371Z","etag":null,"topics":["albert","bert","bilstm-attention","google-colab","pytorch","roberta","xlnet"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/YJiangcm.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":"2020-11-17T08:16:27.000Z","updated_at":"2023-10-20T06:08:37.000Z","dependencies_parsed_at":"2022-08-01T00:37:58.544Z","dependency_job_id":null,"html_url":"https://github.com/YJiangcm/SST-2-sentiment-analysis","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/YJiangcm/SST-2-sentiment-analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJiangcm%2FSST-2-sentiment-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJiangcm%2FSST-2-sentiment-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJiangcm%2FSST-2-sentiment-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJiangcm%2FSST-2-sentiment-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YJiangcm","download_url":"https://codeload.github.com/YJiangcm/SST-2-sentiment-analysis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJiangcm%2FSST-2-sentiment-analysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285335552,"owners_count":27154282,"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-11-19T02:00:05.673Z","response_time":65,"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":["albert","bert","bilstm-attention","google-colab","pytorch","roberta","xlnet"],"created_at":"2025-11-15T04:00:41.315Z","updated_at":"2025-11-19T22:01:15.695Z","avatar_url":"https://github.com/YJiangcm.png","language":"Jupyter Notebook","funding_links":[],"categories":["Related Datasets Link"],"sub_categories":["**Other**"],"readme":"# SST-2-sentiment-analysis\n\nUse BiLSTM_attention, BERT, RoBERTa, XLNet and ALBERT models to classify the SST-2 data set based on pytorch.\n\nThese codes are recommended to  run in **Google Colab**, where  you may use free GPU resources.\n\n## 1. Experiment results of BiLSTM_attention models on test set:\nThe **BiLSTM_attention model** can let us know which words in a sentence do contributions to the sentiment of this sentence. The code is avalibale in \"bilstm_attention.ipynb\",  where **two types of self-attention mechanism** have been achieved. You can run it in Google Colab for practice. The visualization result is shown below:\n\n\u003cimg src=\"https://github.com/YJiangcm/Movielens1M-Movie-Recommendation-System/blob/main/pictures/attention%E5%8F%AF%E8%A7%86%E5%8C%962.PNG\" width=\"800\" height=\"300\"\u003e\n\n## 2. Experiment results of BERT models on test set:\nFor specific BERT models, you can find them from https://huggingface.co/models and then do modify in \"models.py\".\n### 2.1 base model\n Model | Accuracy | Precision\t| Recall | F1\n ---- | -----  |----- |----- |----- \n BERT (base-uncased) | 91.8 |\t91.8 |\t91.8\t| 91.8\nRoBERTa (base-uncased)\t| **93.4**\t| **93.5**\t| **93.4**\t| **93.3**\nXLNet (base-uncased)\t| 92.5\t| 92.5\t| 92.5\t| 92.5\nALBERT (base-v2-uncased)\t| 91.4\t| 91.4\t| 91.4\t| 91.4\n\n### 2.2 large model\n Model | Accuracy | Precision\t| Recall | F1\n ---- | -----  |----- |----- |----- \nBERT (large-uncased) \t| 93.1\t| 93.2\t| 93.1\t| 93.1\nRoBERTa (large-uncased)\t| 94.9\t| 95.0\t| 95.0\t| 94.9\nXLNet (large-uncased)\t| 94.6\t| 94.7\t| 94.6\t| 94.6\nALBERT (large-v2-uncased)\t| 92.2\t| 92.3\t| 92.2\t| 92.2\nALBERT (xlarge-v2-uncased)\t| 93.8\t| 93.8\t| 93.9\t| 93.8\nALBERT (xxlarge-v2-uncased)\t| **95.9**\t| **95.9**\t| **95.9**\t| **95.9**\n\n### 2.3 base model + text attack\n Model | Accuracy | Precision\t| Recall | F1\n ---- | -----  |----- |----- |----- \n BERT (base-uncased) + textattack |\t92.4\t|92.8\t|92.4\t|92.4\nRoBERTa (base-uncased) + textattack\t|**94.3**\t|**94.3**\t|**94.3**\t|**94.3**\nXLNet (base-uncased) + textattack\t|93.7\t|93.8\t|93.7\t|93.7\nALBERT (base-uncased) + textattack\t|92.0\t|92.0|\t92.0\t|92.0\n\n## LICENSE\nPlease refer to [MIT License Copyright (c) 2020 YJiangcm](https://github.com/YJiangcm/Movielens1M-Movie-Recommendation-System/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYJiangcm%2FSST-2-sentiment-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYJiangcm%2FSST-2-sentiment-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYJiangcm%2FSST-2-sentiment-analysis/lists"}