https://github.com/naivehobo/hobonet
Convolution Neural Network for classification of semantic relations in a sentence
https://github.com/naivehobo/hobonet
embeddings-word2vec natural-language-processing natural-language-understanding relation-classification semeval semeval-2018 semeval2014 sentence-classification word2vec
Last synced: 26 days ago
JSON representation
Convolution Neural Network for classification of semantic relations in a sentence
- Host: GitHub
- URL: https://github.com/naivehobo/hobonet
- Owner: naiveHobo
- Created: 2017-08-22T21:00:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-24T21:51:57.000Z (almost 8 years ago)
- Last Synced: 2025-03-31T00:41:17.410Z (2 months ago)
- Topics: embeddings-word2vec, natural-language-processing, natural-language-understanding, relation-classification, semeval, semeval-2018, semeval2014, sentence-classification, word2vec
- Language: Python
- Homepage:
- Size: 50.1 MB
- Stars: 17
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HoboNet - Relation Classification
Convolution neural network for classification of semantic relationship between two given entities**Test accuracy: 80.06%**
**Macro F1 score (excluding Other): 84.18%**
#### Step 1:
Prepare train.txt and text.txt run preprocess.py:
```
python preprocess.py
```#### Step 2:
To get the vector representation of all the words, and then save them as a pickle.You will need the embeddings we used: https://www.cs.york.ac.uk/nlp/extvec/wiki_extvec.gz
Download the .gz file and place it in a folder called 'embeddings'
```
python prepare_data.py
```
The word embeddings, look-up table, training data and test data get saved into a pickle file in ./pkl#### Step 3:
To train the cnn model:
```
python train.py
```
All the models are saved in ./model#### Step 4:
To view the results of the above step:
```
python test.py
```
It will display the accuracy and the F1 score on the test dataset#### Step 5:
To use the official SemEval2010-Task8 Scorer:
```
perl scorer/semeval2010_task8_scorer-v1.2.pl results/HoboNet_result.txt scorer/test_key.txt > scorer/result_scores.txt
```
This will create result_scores.txt file that contains the official scores and confusion matrix for this task#### Dependencies:
```
NumPy
Keras
cPickle
gzipUse python2
```## References:
- Pengda Qin, Weiran Xu, Jun Guo, An empirical convolutional neural network approach for semantic relation classification, Neurocomputing, Volume 190, 2016, Pages 1-9, ISSN 0925-2312, http://dx.doi.org/10.1016/j.neucom.2015.12.091
- Ngoc Thang Vu, Heike Adel, Pankaj Gupta, Hinrich Schütze, Combining Recurrent and Convolutional Neural Networks for Relation Classification, arXiv:1605.07333 [cs.CL]
- Cicero Nogueira dos Santos, Bing Xiang, Bowen Zhou, Classifying Relations by Ranking with Convolutional Neural Networks, arXiv:1504.06580 [cs.CL]