上次发了一条字符级分类模型的推文,
这两天在家里就是对字符级CNN分类论文进行了代码实现:1509.01626 Character-level Convolutional Networks for Text Classification
项目代码见:https://github.com/howie6879/charcnntext_classification
项目环境:
Python3.6
Anaconda+Pipenv管理
使用
# 下载代码
git clone https://github.com/howie6879/char_cnn_text_classification.git
# 利用anaconda建立Python3.6环境
conda create -n python36 python=3.6
# 进入项目
cd char_cnn_text_classification
# --python 后面的路径是上面conda创建的路径地址
pipenv install --python ~/anaconda3/envs/python36/bin/python3.6
# 如果出错 否则跳过这段
pipenv run pip install pip==18.0
# 安装依赖 具体以来可查看Pipenv文件
pipenv install
# 进入代码目录
cd char_cnn_text_classification
模型
模型结构和论文中介绍的一样: