Algorithm 1: Clustering Guided Hierarchical Activity Recognition Framework. |
Input: Training set D and labels L for activities, Threshold θ, test set tx |
Output: The prediction of activity with label LA of tx |
// TRAINING STAGE |
1. Divide D into groups CLU; // Component #1 |
2. calculate the activity confusion matrix CM of CLU by applying (1) and (2); |
3. Construct cls_all to identify all activities; // Component #2 |
4. for each activity LA of L do |
(4.1) S(LA) = { }; // initialization of LA |
5. for each activity LA of L do |
(5.1) for each activity LB of L do |
obtain η(LB, LA) by applying (3); |
if LA != LB and η(LB, LA) ≥ θ do |
S(LA).add(LB); |
(5.2) if not_empty(S(LA)) do |
construct a cls_LA to distinguish LA and S(LA); |
// PREDICTION STAGE |
6. LA = cls_all (tx); // infer the label of tx by applying the top-level classifier |
7. if not_empty(S(LA)) do |
LA = cls_LA(tx); // infer the label of tx by applying the second-level classifier |
8. return LA |