lccasagrande / Deep-Knowledge-Tracing

An implementation of the Deep Knowledge Tracing (DKT) using Tensorflow 2.0
MIT License
95 stars 38 forks source link
deepknowledgetracing keras knowledge-tracing lstm-networks tensorflow udacity-nanodegree

Deep-Knowledge-Tracing Build Status Coverage Status

This repository contains my implementation of Deep Knowledge Tracing for the Udacity's Capstone Project.

Overview

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.

Requirements

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.

Instructions

  1. Clone the repository and navigate to the downloaded folder.

    git clone https://github.com/lccasagrande/Deep-Knowledge-Tracing.git
    cd Deep-Knowledge-Tracing
  2. 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]
  3. Navigate to the examples folder and:

    • Run the notebook:

      jupyter notebook DKT.ipynb
    • Run the python script:

      python run_dkt.py
  4. [Optional] Analyse the results with tensorboard:

    tensorboard --logdir=logs

    alt text

Custom Metrics

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.

Custom Datasets

To use a different dataset, you must be sure that you have the following columns:

Support

If you have any question or find a bug, please contact me or open an issue. Pull request are also welcome.