This project represents an implementation of PCNN [zeng2015distant], dubbed as Piecewise Convolutional Neural Network, written in Tensorflow. Considered as an application for sentiment attitudes extraction task.
For more details, see:
-
CEUR Workshop Proceedings (will be added soon)
We use RuSentRel 1.0 corpus consisted of analytical articles from Internet-portal inosmi.ru.
Table below illustrates CNN/PCNN results in comparison with baselines (neg, pos, distr), and classifiers (KNN, SVM, Random Forest) based on handcrafted NLP features. Last row represent an asessment of agreement between two annotators.
Model | Precision | Recall | F1(P,N) |
---|---|---|---|
Baseline neg | 0.03 | 0.39 | 0.05 |
Baseline pos | 0.02 | 0.40 | 0.04 |
Baseline distr | 0.05 | 0.23 | 0.08 |
KNN | 0.18 | 0.06 | 0.09 |
SVM (GRID) | 0.09 | 0.36 | 0.15 |
Random forest (GRID) | 0.41 | 0.21 | 0.27 |
CNN | 0.41 | 0.23 | 0.31 |
PCNN | 0.42 | 0.23 | 0.31 |
Expert agreement | 0.62 | 0.49 | 0.55 |
Comparison of CNN and PCNN during training process illustrated in figures below:
Using virtualenv.
Create virtual environment, suppose my_env
, and activate it as follows:
virtualenv my_env
source my_env/bin/activate
Use Makefile
to install
core library and download
dataset:
make install
We use word2vec model which were taken from rusvectores.org and used for an embedding layer completion:
make download_model
The dataset provides only sentiment attitudes. For extraction of positive and negative attitudes we additionally introduce (extract from news) neutral attudes to distinguish really sentiment attitudes from neutral one.
At first, we compose a list of neutral relations per each article by running:
./neutrals.py
And we are ready to apply model with different settings by simply rinning:
./predict_cnn.py
- Daojian Zeng, Kang Liu, Yubo Chen, and Jun Zhao, Distant supervision for relation extraction via piecewise convolutional neural networks, Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, 2015, pp. 1753–1762 [paper]