Homework 9

In this homework we will predict the future. You’ll use a new tux dataset and design a model to predict the users actions conditioned on their previous actions.

starter code data

Action prediction

You will design a network similar to the earlier homeworks to predict what action (keyboard input) your fellow classmates took, when they played the game. The input is a vector of the previous actions where each action is a 6d binary vector of key states (0: up, 1:down). You have to predict the next action as six binary predictions (one per key), for this given sequence and you can use standard classification models you built in earlier homeworks.

In this homework we simply measure how well you can fit these actions. The next homework will focus on using these actions to play supertux.

Once you have specified the network, train it.

Input example

Keystates for current Action:

0 0 1 1 0 0

Output example

Logits of prediction actions:

-5.1 -1 0.6 0.2 -0.1 0.1

which is equivalent to the key states: 0 0 1 1 0 1

Getting Started

We provide you with starter code that loads the dataset from a training and validation set. We also provide an optional tensorboard interface.

  1. Define your model in models.py and modify the training code in train.py.
  2. Train your model.
     python3 -m homework.train
    
  3. Optionally, you can use tensorboard to visualize your training loss and accuracy.
     python3 -m homework.train -l myRun
    

    and in another terminal tensorboard --logdir myRun, where myRun is the log directory. Pro-tip: You can run tensorboard on the parent directory of many logs to visualize them all.

  4. Test your model by measuring the prediction accuracy
     python3 -m homework.test -i 32
    
  5. To evaluate your code against grader, execute:
     python3 -m grader homework
    
  6. Create the submission file
     python3 -m homework.bundle
    

Grading

We will have a linear grading scheme depending on your log-likelihood scores.

* Log-likelihood 0.2: 0 points
* Log-likelihood 0.1: 100 points

Note

In order to evaluate your model properly, we will feed evaluation sequences in action by action. We created a special SeqPredictor class that will help with this. The SeqPredictor is guaranteed to read a sequence in order, and can optionally keep some internal state (or past inputs) around. The SeqPredictor needs to return a prediction for the next action before it sees the next input. This is different from the model training, where you get to see the entire input sequence at once.

Relevant operations