Two-Level Behavior Classification

Share:

Description

Contains functions for training and applying two-level random forest and hidden Markov models for human behavior classification from raw tri-axial accelerometer and/or GPS data.

This code works with csv data from Actigraph accelerometers (please export in RAW format, without timestamps), and/or with GPS data processed by the PALMS GPS cleaning software.

The TLBC classifier uses six behavior labels:

  • Sitting

  • Standing Still

  • Standing Moving

  • Walking/Running

  • Bicycling

  • Vehicle

Function classify uses a pre-learned TLBC model to classify accelerometer and/or GPS data with behavior labels. Pre-trained models that have been trained on three UCSD datasets are available for download.

Function trainModel trains a TLBC model from annotated accelerometer and/or GPS data.

Function calcPerformance computes the accuracy of predictions made on a given dataset.

Function looXval performs leave-one-out cross-validation on a dataset.

Details

Package: TLBC
Type: Package
Version: 1.0
Date: 2015-05-29
License: GPL-2

Author(s)

Katherine Ellis <kellis@ucsd.edu>

See Also

randomForest, HMM

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Not run: 

# train a new model
myAnnotations="~/myStudy/annotations.csv"
myAccel="~/myStudy/HipGT3X+"
myGPS="~/myStudy/GPS.csv"
WS=60
myModel="~/myStudy/myModel.RData"
trainModel(annotations=myAnnotations, accelerometers=myAccel, GPS=myGPS, winSize=WS, 
modelName=myModel)

# classify using a model computed yourself
myAccel="~/myStudy/HipGT3X+"
myGPS="~/myStudy/GPS.csv"
myModel="~/myStudy/myModel.RData"
myPredictions="~/myStudy/myModelPredictions"
classify(accelerometers=myAccel, GPS=myGPS, modelName=myModel, saveDir=myPredictions)

# compute the performance of a model on a dataset
myAnnotations="~/myStudy/annotations.csv"
myPredictions="~/myStudy/myModelPredictions"
WS=60
calcPerformance(annotations=myAnnotations, predictions=myPredictions, winSize=WS)

# perform leave-one-out cross-validation on a dataset
myAnnotations="~/myStudy/annotations.csv"
myAccel="~/myStudy/HipGT3X+"
WS=60
myPredictions="~/myStudy/looXvalPredictions"
looXval(annotations=myAnnotations, accelerometers=myAccel, winSize=WS, saveDir=myPredictions)


## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.