Learn R Programming

TLBC (version 1.0)

TLBC-package: Two-Level Behavior Classification

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.

Arguments

Details

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

See Also

randomForest, HMM

Examples

Run this code

## 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)

Run the code above in your browser using DataLab