Required for students registered for 290B
Optional for students registered for 190B
Write a program that recognizes human behavior from sensor data using a hidden Markov model (HMM). Test your program on the data set that was used in the paper Fine-Grained Activity Recognition by Aggregating Abstract Object Usage by Patterson et al. You can download a zip file of all data here: a5data.zip.
The data is in the following format:
<objectID> <activityID>
<objectID> <activityID>
<objectID> <activityID>
etc. Different lines correspond to distinct sensor readings, ordered by time.
Included are 10 days of data (e.g., day01.data). Also included are concatenations of all but one of those days (e.g., allbut01.data). The latter files allow you to train from multiple days. By training on all but the first day, then using the first day as test data, you have independent training and test sets. You can repeat using all but the second day and testing on the second day, etc. Doing this all ten times is called performing a 10-fold cross validation.
Each activity corresponds to a single state in an HMM, and there are transitions between every pair of states. Training means computing the state transition probabilities and the object observation probabilities from the training data. For example, to compute the transition probability from state A to state B, divide the number of times state B follows state A in the training data by the total number of times state A occurs. To compute the probability that object O is observed when in state A, divide the number of times O and A occur simultaneously by the number of times A occurs.
In the testing phase, you use only the <objectID> column as input to your HMM. You want to compute the most likely sequence of states for the selected day's data. You do this by implementing the Viterbi algorithm, which, as we discussed in class, can be implemented using a shortest-path algorithm. You then take the most likely sequence you computed and compare it to the actual sequence of states for that day, that is, the <activityID> column of the day's data. Compute the accuracy of the results by dividing the number of times the computed and actual states agree by the total length of the state sequence. Finally, calculate the average accuracy you get over all 10 times you repeat this procedures in the 10-fold cross-validation.
If you're curious about the meanings of the numbers, state_mapping.txt and tag_mapping.txt give the actual state and object names. Also included are extended data files that give a time stamp for each reading, along with all secondary activities being performed concurrently at each time step (e.g., full.002.01.data.) Sensor readings for single activities are provided as well (e.g., single.door.01.data).
Important points:
Turn in hardcopy in class on February 27: