Deep learning model that extracts answer from two sentences.
I ran the code on Google Colab and forgot to create the requirements.txt
file. Please install the necessary dependencies manually.
- Preprocesses the data
- Trains a neural network model to extract answers from two sentences
- Evaluates the model and visualizes the results
The bAbI dataset is a set of 20 tasks designed to test text understanding and reasoning. Each task has a specific focus, such as basic deduction, induction, counting, or pathfinding. For this project, we use task 1: Single Supporting Fact, which involves reading two sentences and answering a question based on them.
The dataset is downloaded from the S3 storage and extracted using the following commands in the notebook:
!wget https://s3.amazonaws.com/text-datasets/babi_tasks_1-20_v1-2.tar.gz
!tar -xzvf babi_tasks_1-20_v1-2.tar.gz
The dataset contains several text files, each corresponding to a specific task. For task 1, the files used are:
- qa1_single-supporting-fact_train.txt
- qa1_single-supporting-fact_test.txt
Each line in these files represents a sequence of sentences or a question-answer pair. Sentences are labeled with a line number, while questions are followed by an answer and a list of supporting sentences.
- Mary moved to the bathroom.
- John went to the hallway.
- Where is Mary? bathroom
- Training Accuracy: 74%, Validation Accuracy: 67%.
- Training Loss: 0.7815, Validation Loss: 0.9786.
- Daniel moved to the bathroom.
- Mary journeyed to the garden.
- Where is Daniel?
- predication:
bathroom
- Python 3.x
- Required libraries:
numpy
,keras
,matplotlib
Contributions are welcome! Feel free to open issues or submit pull requests or if you have any ideas to improve the accuracy.
For any inquiries or support, please contact Adnan AlKharfan.