Machine Learning Course Project, IMDB movie review sentiment analysis by lstm, cnn, and transformer

Overview

IMDB Sentiment Analysis

This is the final project of Machine Learning Courses in Huazhong University of Science and Technology, School of Artificial Intelligence and Automation

Training

To train a model (CNN, LSTM, Transformer), simply run

python train.py --cfg <./model/xxx> --save <./save/>

You can change the configuration in config.

Model

LSTM

we follow the origin LSTM as possible

lstm

CNN

we adopt the methods mentioned in Effective Use of Word Order for Text Categorization with Convolutional Neural Networks

cnn

Transformer

We use the original Transformer Encoder as Attention is all you need and use the concept of CLS Token as BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding

trans

Experiment result

Model Comparison

Model Accuracy
LSTM 89.02
Transformer 87.47
CNN 88.66
Fine-tuned BERT 93.43

LSTM

Batch size
Batch size Loss Accuracy
64 0.4293 0.8802
128 0.4298 0.8818
256 0.4304 0.8836
512 0.4380 0.8807
Embedding Size
Embedding size train Loss train Accuracy val loss val accuracy
32 0.4021 0.9127 0.4419 0.8707
64 0.3848 0.9306 0.4297 0.8832
128 0.3772 0.9385 0.4265 0.8871
256 0.3584 0.9582 0.4303 0.8825
512 0.3504 0.9668 0.4295 0.8838
Drop out
Drop out rate Train Loss Train Accuracy Test loss Test Accuracy
0.0 0.3554 0.9623 0.4428 0.8704
0.1 0.3475 0.9696 0.4353 0.8780
0.2 0.3516 0.9652 0.4312 0.8825
0.3 0.3577 0.9589 0.4292 0.8844
0.4 0.3587 0.9576 0.4272 0.8868
0.5 0.3621 0.9544 0.4269 0.8865
0.6 0.3906 0.9242 0.4272 0.8863
0.7 0.3789 0.9356 0.4303 0.8826
0.8 0.3939 0.9204 0.4311 0.8826
0.9 0.4211 0.8918 0.4526 0.8584
Weight decay
Weight decay train loss train accuracy test loss test accuracy
1.0e-8 0.3716 0.9436 0.4261 0.8876
1.0e-7 0.3803 0.9349 0.4281 0.8862
1.0e-6 0.3701 0.9456 0.4264 0.8878
1.0e-5 0.3698 0.9461 0.4283 0.8850
1.0e-4 0.3785 0.9377 0.4318 0.8806
Number layers

Number of LSTM blocks

Number layers train loss train accuracy test loss test accuracy
1 0.3786 0.9364 0.4291 0.8844
2 0.3701 0.9456 0.4264 0.8878
3 0.3707 0.9451 0.4243 0.8902
4 0.3713 0.9446 0.4279 0.8857

CNN

out channel size
out size train acc test acc
8 0.9679 0.8743
16 0.9791 0.8767
32 0.9824 0.8811
64 0.9891 0.8848
128 0.9915 0.8824
256 0.9909 0.8827
512 0.9920 0.8841
1024 0.9959 0.8833
multi scale filter
Number train acc test acc
1 [5] 0.9698 0.8748
2 [5, 11] 0.9852 0.8827
3 [5, 11, 17] 0.9890 0.8850
4 [5, 11, 17, 23] 0.9915 0.8848
5 [5, 11, 17, 23, 29] 0.9924 0.8842
6 [5, 11, 17, 23, 29, 35] 0.9930 0.8836
step train acc test acc
2 [5 7 9] 0.9878 0.8816
4 [5 9 11] 0.9890 0.8816
6 [5 11 17] 0.9919 0.8834
8 [5 13 21] 0.9884 0.8836
10[5 15 25] 0.9919 0.8848
12[5 17 29] 0.9898 0.8812
14[5 29 43] 0.9935 0.8809
Owner
Daniel
Daniel
All the code I wrote for Overwatch-related projects that I still own the rights to.

overwatch_shit.zip This is (eventually) going to contain all the software I wrote during my five-year imprisonment stay playing Overwatch. I'll be add

zkxjzmswkwl 2 Dec 31, 2021
A python wrapper around the ZPar parser for English.

NOTE This project is no longer under active development since there are now really nice pure Python parsers such as Stanza and Spacy. The repository w

ETS 49 Sep 12, 2022
Residual2Vec: Debiasing graph embedding using random graphs

Residual2Vec: Debiasing graph embedding using random graphs This repository contains the code for S. Kojaku, J. Yoon, I. Constantino, and Y.-Y. Ahn, R

SADAMORI KOJAKU 5 Oct 12, 2022
Türkçe küfürlü içerikleri bulan bir yapay zeka kütüphanesi / An ML library for profanity detection in Turkish sentences

"Kötü söz sahibine aittir." -Anonim Nedir? sinkaf uygunsuz yorumların bulunmasını sağlayan bir python kütüphanesidir. Farkı nedir? Diğer algoritmalard

KaraGoz 4 Feb 18, 2022
This repository describes our reproducible framework for assessing self-supervised representation learning from speech

LeBenchmark: a reproducible framework for assessing SSL from speech Self-Supervised Learning (SSL) using huge unlabeled data has been successfully exp

49 Aug 24, 2022
Code for paper: An Effective, Robust and Fairness-awareHate Speech Detection Framework

BiQQLSTM_HS Code and data for paper: Title: An Effective, Robust and Fairness-awareHate Speech Detection Framework. Authors: Guanyi Mou and Kyumin Lee

Guanyi Mou 2 Dec 27, 2022
xFormers is a modular and field agnostic library to flexibly generate transformer architectures by interoperable and optimized building blocks.

Description xFormers is a modular and field agnostic library to flexibly generate transformer architectures by interoperable and optimized building bl

Facebook Research 2.3k Jan 08, 2023
Retraining OpenAI's GPT-2 on Discord Chats

Train OpenAI's GPT-2 on Discord Chats Retraining a Text Generation Model on Discord Chats using gpt-2-simple that wraps existing model fine-tuning and

Ayush Mishra 4 Oct 27, 2022
【原神】自动演奏风物之诗琴的程序

疯物之诗琴 读取midi并自动演奏原神风物之诗琴。 可以自定义配置文件自动调整音符来适配风物之诗琴。 (原神1.4直播那天就开始做了!到现在才能放出来。。) 如何使用 在Release页面中下载打包好的程序和midi压缩包并解压。 双击运行“疯物之诗琴.exe”。 在原神中打开风物之诗琴,软件内输入

435 Jan 04, 2023
An easy to use, user-friendly and efficient code for extracting OpenAI CLIP (Global/Grid) features from image and text respectively.

Extracting OpenAI CLIP (Global/Grid) Features from Image and Text This repo aims at providing an easy to use and efficient code for extracting image &

Jianjie(JJ) Luo 13 Jan 06, 2023
Large-scale pretraining for dialogue

A State-of-the-Art Large-scale Pretrained Response Generation Model (DialoGPT) This repository contains the source code and trained model for a large-

Microsoft 1.8k Jan 07, 2023
This repo stores the codes for topic modeling on palliative care journals.

This repo stores the codes for topic modeling on palliative care journals. Data Preparation You first need to download the journal papers. bash 1_down

3 Dec 20, 2022
SimCTG - A Contrastive Framework for Neural Text Generation

A Contrastive Framework for Neural Text Generation Authors: Yixuan Su, Tian Lan,

Yixuan Su 345 Jan 03, 2023
NLP applications using deep learning.

NLP-Natural-Language-Processing NLP applications using deep learning like text generation etc. 1- Poetry Generation: Using a collection of Irish Poem

KASHISH 1 Jan 27, 2022
A collection of GNN-based fake news detection models.

This repo includes the Pytorch-Geometric implementation of a series of Graph Neural Network (GNN) based fake news detection models. All GNN models are implemented and evaluated under the User Prefere

SafeGraph 251 Jan 01, 2023
open-information-extraction-system, build open-knowledge-graph(SPO, subject-predicate-object) by pyltp(version==3.4.0)

中文开放信息抽取系统, open-information-extraction-system, build open-knowledge-graph(SPO, subject-predicate-object) by pyltp(version==3.4.0)

7 Nov 02, 2022
CLIPfa: Connecting Farsi Text and Images

CLIPfa: Connecting Farsi Text and Images OpenAI released the paper Learning Transferable Visual Models From Natural Language Supervision in which they

Sajjad Ayoubi 66 Dec 14, 2022
UniSpeech - Large Scale Self-Supervised Learning for Speech

UniSpeech The family of UniSpeech: WavLM (arXiv): WavLM: Large-Scale Self-Supervised Pre-training for Full Stack Speech Processing UniSpeech (ICML 202

Microsoft 281 Dec 15, 2022
A BERT-based reverse dictionary of Korean proverbs

Wisdomify A BERT-based reverse-dictionary of Korean proverbs. 김유빈 : 모델링 / 데이터 수집 / 프로젝트 설계 / back-end 김종윤 : 데이터 수집 / 프로젝트 설계 / front-end / back-end 임용

94 Dec 08, 2022
A workshop with several modules to help learn Feast, an open-source feature store

Workshop: Learning Feast This workshop aims to teach users about Feast, an open-source feature store. We explain concepts & best practices by example,

Feast 52 Jan 05, 2023