Function to train a two-level model from accelerometer and/or GPS data

Share:

Description

Trains a two-level model from accelerometer and/or GPS data.

Usage

1
2
trainModel(annotations, accelerometers=NULL, GPS=NULL, winSize=60, modelName, names=NULL, 
strat=TRUE, ntree=500, mtry=NULL, replace=TRUE, nsample=10000, nodesize=1, sampsize=10000)

Arguments

annotations

Path to a file containing bout-level annotations (or directory of files containing bout-level annotations). Should be csv format with fields: identifier,StartDateTime,EndDateTime,behavior.

Or, path to a directory containing instance-level annotations, i.e., created by the function annotationsToLabels.

accelerometers

(Optional) Path to a directory (or list of directories) containing actigraph accelerometer data files. Accelerometer data files should be csv files output in "raw" format by ActiLife (without timestamps), and named by the participant identifier, e.g., Participant01.csv.

Or, path to a directory (or list of directories) containing previously computed accelerometer features, i.e., computed by the function sensorsToFeatures.

GPS

(Optional) Path to a PALMS-processed GPS data file (or a directory containing GPS data files). GPS data files should be in csv format with the following fields: identifier, dateTime, speed, ele, elevationDelta, lat, lon, nsatView, snrView. identifier should be the participant identifier, e.g. Participant01. If GPS is a path to a directory, each file in the directory should correspond to a participant, and the file name should be the participant identifier, e.g., Participant01.csv.

Or, path to a directory containing previously computed GPS features, i.e., computed by the function sensorsToFeatures.

winSize

Window size in seconds.

modelName

Path to location to save model.

names

(Optional) List of participant identifiers to use.

strat

(Optional) logical: use stratified sampling for the random forest?

ntree

(Optional) Number of trees in the random forest

mtry

(Optional) Number of variables randomly sampled as candidates at each split in the random forest.

replace

(Optional) Should sampling in the random forest be done with or without replacement?

nsample

(Optional) Number of instances to sample.

nodesize

(Optional) Minimum size of terminal nodes in the random forest.

sampsize

(Optional) Size of sample to draw for the random forest.

Author(s)

Katherine Ellis

See Also

classify, looXval

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
myAnotations="~/myStudy/annotations.csv"
myAccel="~/myStudy/HipGT3X+"
myGPS="~/myStudy/GPS.csv"
winSize=60
myModel="~/myStudy/myModel.RData"
trainModel(annotations=myAnotations, accelerometers=myAccel, GPS=myGPS, winSize=WS, 
modelName=myModel)

## End(Not run)

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