This project provides two approaches for relation extraction classification using deep learning and machine learning techniques.
- Approach 1: Deep Learning using Neural Networks
- Approach 2: Machine Learning using Support Vector Machines (SVM) with Stacking Classifier
Both approaches are implemented in Python and can be executed on Google Colab.
You can open the provided Python notebooks in Google Colab for training and testing the models:
Final_Neural_Networks_Model.pynbFinal_StackingClassifier_Model.ipynb
Once you open the Colab notebooks, follow these steps:
Execute the cells one by one to install the required libraries and load the necessary functions.
-
glove.6B.100d.txt for the neural-based approach:
- Download the GloVe embeddings file from the link below: GloVe Embeddings
- Upload it in the Colab runtime under the "Files" section.
-
classifier.py for both approaches:
- Upload the
classifier.pyfile to the Colab environment. This file is already included in the project folder. You can either upload it directly or use a cloud storage link.
- Upload the
- Enable GPU Acceleration: Ensure you have T4 GPU enabled in Colab for faster training.
- Execute the cells in the
Final_Neural_Networks_Model.pynbto train the deep learning model. - Use the same notebook for testing and user-testing.
- Execute the cells in the
Final_StackingClassifier_Model.ipynbto train and test the SVM-based model. - For faster user-testing compilation, you can also use the
Final_StackingClassifier_UserTesting.ipynbnotebook.
For classifying new sentences after model training, use the classifier.py module. Follow these import statements for each approach:
-
For Deep Learning Approach:
from classifier import classify_relation
-
For SVM Approach:
from classifier import classify_relation_svm