November 17, 2004

Modeling ADLs with Untimed HMMs: updated

UntimedHMM.jpg

There are now four models that I have tested with this data. The first model is a simple HMM that is event driven: activities are only allowed to switch when a tag is seen. This is called the "Untimed" Model.
The second model is a simple HMM that is clock driven: activities are allowed to switch on every clock tick whether or not a tag is seen. I'm calling this the "Timed" Model. In fact it enforces an exponential distribution on the activities just by the nature of the self transition.
The third model is an HMM that is also clock driven, but I add a countdown variable to enforce a different distribution that an exponential distribution. In this case I enforce a gamma distribution.
The final model is an HMM in which each activity is a three state sequence. I train each activity separately to get an implicit gamma distribution (negative binomial).

TimedHMM.jpg

In the first three cases to model this domain with HMMs I segmented each of the traces into their 12 composite activities. I calculated P(RFID objects given activity). In the timed cases I added a null observation for each second in which there was no RFID observation. Then I constructed an HMM in which there was one node for each activity. Each node has a self-transition whose probability was calculated based on mean duration (exponential timed case) or mean number of observations per activity (untimed case). In the gamma case the "D"uration varable governs the "A"ctivity state switches. Each "A"ctivity state can transition to any of the other 13 states with a uniform probability. The HMMs start with a uniform prior over all of the activities. I then performed 17 fold cross-validation on the user traces and determined the viterbi path through the state space that corresponded to left out user trace.

gammaHMM.jpg

For the gamma distribution I used the DBN on the left to do inference. Since I'm using a plain vanilla viterbi algorithm I create the full |A|x|D| state space to represent the world. "A" is the Activity that is being performed. "D" is the number of seconds left in the activity. Normally "A" stays the same from time to time+1, and "D" counts down deterministically. When "D" reaches 0, "A" is chosen uniformly from the next possible activities. Then "D" is chosen according the gamma distribution associated with the new "A". Then I do exact inference to explain the observed tag sequence and recover the optimal state path through time.

NegBinomial.jpg For the fourth system I enforced each activity to consist of a three state sequence which was trained using EM.

Here are some comparitive results for using flavors of HMMs to recognize ADLs. In both cases the same data set was used: The dataset that Matthai first recorded at his house.

Info about the dataset

Activity Class# of traces in datasetDuration of Activity (sec.)Average # of objects touched
1Personal Appearance16 91 5.13
2Oral Hygiene131086.38
3Toileting15111 4.67
4Hand Washing11 75 3.82
5Housecleaning16 134 3.69
6Appliance Usage13(or 16 depending) 92 3.15
7Prepare a snack12 174 7.75
8Prepare a drink19(or 16 depending)135 4.84
9Control the temperature1567 1.13
10Laundry11146 4.36
11Leisure15152 3.47
12Telephone Usage17149 3.00
13Infant Care17160 5.94
14Take Medication14742.5
Mean (std)14.6 (2.4)119(35)4.27 (1.7)

Info about the results

Untimed HMMTimed HMMDiscrete GammaImplicit Gamma
Total Number of Activities user's performed:(17*12) = 204
Number of completely missed Activities (False Negatives)718149
*Average duration of missed activity (sec)71.076.770.0782
*Average number of objects touched in a missed activity2.02.32.23.4
Number of added Activities (False Positives)326840
Number of confused Activities9141413
Total errors FP+FN+Confused49383662
Overall Recall
(Correctly guessed activities)/(All true activities)
191/204=93.6%172/204=84.3%176/204=86.3%182/204=89.2%
Overall Precision
(Correctly guessed activiites)/(All guessed activities)
191/229 =83.4% 172/192= 89.6% 176/198= 88.9%182/235=77.4%

Confusion Matrix for HMM without timing

Guess-> 1 2 3 4 5 6 7 8 9 10 11 12 13 14FN
11411
213
3141
4182
516
6112
712
811413
915
1011
1115
1217
1317
1414
FP 0 2 4 2 3 7 3 6 0 3 2 0 0 0

Confusion Matrix for HMM with exponential timing

Guess-> 1 2 3 4 5 6 7 8 9 10 11 12 13 14FN
111122
213
3771
4182
5151
61411
712
8187
9132
10101
11132
1217
1317
1414
FP 0 2 0 2 0 2 0 0 0 0 0 0 0 0

Confusion Matrix for HMM with discretized gamma function

Guess-> 1 2 3 4 5 6 7 8 9 10 11 12 13 14FN
11420
213
3861
4182
5151
613111
712
81186
91140
10110
11123
1217
1317
1414
FP 0 2 0 2 0 2 0 0 0 0 1 1 0 0

Confusion Matrix for HMM with implicit gamma function

Guess-> 1 2 3 4 5 6 7 8 9 10 11 12 13 14FN
11330
213
311211
4263
511311
61211
712
813112
9150
10110
11150
1217
1317
1414
FP 5 1 1 3 8 4 4 2 1 6 2 0 0 3
Posted by djp3 at 10:00 AM | Comments (0) | TrackBack (0)