Skip to content

iorwe/Al_PA2

Repository files navigation

情感分类模型

运行环境

  • Python 3.11.8
  • PyTorch 2.2.2
  • tqdm
  • gensim

请确保安装了以上库,以保证程序正常运行。

使用方法

  • 在文件根目录下使用命令
	python main.py
  • 默认使用隐藏层单元为100MLP模型。
  • 训练前需要确认模型参数信息,如果已经存在训练好的模型会询问是否要重新训练模型。
  • 可以通过-[] []传入参数来选择不同的模型和配置。(使用-t N可以直接使用训练好的模型)

可选参数

命令 参数 用途 默认值
-m model 选择模型,可选参数: cnn, rnn,lstm, gru,mlp mlp
-e epoch 最大迭代次数 100
-b batch_size 批量大小 64
-lr learning_rate 学习率 0.01
-sl sequence_length 句子词数 64
-t if_train 是否训练新模型,可选参数: Y/N(y/n) Y
-nf num_filters CNN模型每个卷积核数量 100
-fz filter_size CNN卷积核大小 [2,3,4]
-hd hidden_dim 隐藏层数量 100
-nl num_layers RNN隐藏层数 1
-bi bidirectional RNN是否双向 Fasle

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages