This repository contains my implementation of Deep Knowledge Tracing for the Udacity's Capstone Project.
The objective is to predict the probabilities of a student correctly answering a problem not yet seen by him. To this end, we train the model using the ASSISTments Skill-builder data 2009-2010 public dataset.
You'll need Python 3.7 x64 and Tensorflow 2.0 to be able to run this project.
If you do not have Python installed yet, it is recommended that you install the Anaconda distribution of Python, which has almost all packages required in this project. You can also install Python 3.7 x64 from here.
Tensorflow 2.0 is installed along with the project. Check the instructions below.
-
Clone the repository and navigate to the downloaded folder.
git clone https://github.com/lccasagrande/Deep-Knowledge-Tracing.git cd Deep-Knowledge-Tracing
-
Install required packages:
-
If you want to install with Tensorflow-CPU, type:
pip install -e .[tf]
-
Otherwise, if you want to install with TensorFlow-GPU follow this guide to check the necessary NVIDIA software. After that, type:
pip install -e .[tf_gpu]
-
-
Navigate to the examples folder and:
-
Run the notebook:
jupyter notebook DKT.ipynb
-
Run the python script:
python run_dkt.py
-
-
[Optional] Analyse the results with tensorboard:
tensorboard --logdir=logs
To implement custom metrics, first decode the label and then calculate the metric. This step is necessary because we encode the skill id with the label to implement the custom loss.
Here's a quick example:
import tensorflow as tf
from deepkt import data_util
def bin_acc(y_true, y_pred):
true, pred = data_util.get_target(y_true, y_pred)
return tf.keras.metrics.binary_accuracy(true, pred, threshold=0.5)
dkt_model.compile(optimizer='rmsprop', metrics=[bin_acc])
Take a look at deepkt/metrics.py to check more examples.
To use a different dataset, you must be sure that you have the following columns:
- user_id: The identifier of the student.
- skill_id: The identifier of the skill of the question.
- correct: The answer to the question [0, 1].
If you have any question or find a bug, please contact me or open an issue. Pull request are also welcome.