-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.html
57 lines (57 loc) · 8.86 KB
/
README.html
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1404.13">
<style type="text/css">
p.p3 {margin: 0.0px 0.0px 10.0px 0.0px; line-height: 20.0px; font: 14.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 18.0px; font: 13.0px Courier; color: #333333; -webkit-text-stroke: #333333; background-color: #ffffff}
li.li4 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 20.0px; font: 14.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333}
span.s1 {font-kerning: none}
span.s2 {-webkit-text-stroke: 0px #000000}
span.s3 {font: 14.0px 'Helvetica Neue'; font-kerning: none; color: #337ab7; -webkit-text-stroke: 0px #337ab7}
ul.ul1 {list-style-type: disc}
</style>
</head>
<body>
<h1 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 39.0px; font: 36.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">TLBC: Two-Level behavior classification R package</span></h1>
<h2 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 33.0px; font: 30.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">About</span></h2>
<p class="p3"><span class="s1">Two-Level behavior classification (TLBC) is an R package for classifying human behaviors from accelerometer and/or GPS data. The package contains functions for training and applying two-level random forest and hidden Markov models.</span></p>
<p class="p3"><span class="s1">The package has been developed for csv data from Actigraph accelerometers (please export in RAW format, without timestamps), and/or GPS data processed by the PALMS GPS cleaning software.</span></p>
<p class="p3"><span class="s1">The TLBC classifier uses six behavior labels:</span></p>
<ul class="ul1">
<li class="li4"><span class="s2"></span><span class="s1">Sitting</span></li>
<li class="li4"><span class="s2"></span><span class="s1">Standing Still</span></li>
<li class="li4"><span class="s2"></span><span class="s1">Standing Moving</span></li>
<li class="li4"><span class="s2"></span><span class="s1">Walking/Running</span></li>
<li class="li4"><span class="s2"></span><span class="s1">Bicycling</span></li>
<li class="li4"><span class="s2"></span><span class="s1">Vehicle</span></li>
</ul>
<h2 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 33.0px; font: 30.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">Installation</span></h2>
<p class="p3"><span class="s1">Download and unzip the folder. Install the package by running the following command in R:</span></p>
<p class="p5"><span class="s1">install.packages("path/to/TLBC", type="source", repos=NULL)</span></p>
<p class="p3"><span class="s1">Load the package by running the following command in R:</span></p>
<p class="p5"><span class="s1">library(TLBC)</span></p>
<h2 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 33.0px; font: 30.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">Formatting the data</span></h2>
<p class="p3"><span class="s1">Each participant should have a unique participant identifier which will be used to match data between devices (if applicable). You should have a separate directory containing data from each device, and a separate direcory for any annotation files.</span></p>
<h3 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 26.0px; font: 24.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">Accelerometer files</span></h3>
<p class="p3"><span class="s1">Accelerometer data files should be stored in their own directory and should be csv files output in “raw” format by Actilife (without timestamps) named by a unique participant identifier (<i>e.g.</i>, “Participant01.csv”). If your study has multiple accelerometers, each accelerometer placement (<i>e.g.</i>, hip or waist) should be a separate directory.</span></p>
<h3 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 26.0px; font: 24.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">GPS Files</span></h3>
<p class="p3"><span class="s1">GPS data files should be stored in their own directory and should be in csv format with the following fields: <i>identifier, dateTime, speed, ele, elevationDelta, lat, lon, nsatView, snrView.</i> These fields can be exported by UCSD’s <a href="https://ucsd-palms-project.wikispaces.com/"><span class="s3">PALMS</span></a> GPS cleaning and processing software, or you can manually create the data file with necessary fields. The <i>identifier</i> field should be the unique participant identifier (<i>e.g.</i>, “Participant01”) - if multiple devices (<i>e.g.</i> accelerometer and GPS) are being used, it is essential that the participant identifiers match exactly across devices in order to match the data sources correctly. You can either include all GPS in a single file, or have one file for each participant. If using a separate file for each participant, the file name should be the unique participant identifier (<i>e.g.</i>, “Participant01.csv”).</span></p>
<h3 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 26.0px; font: 24.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">Annotation Files</span></h3>
<p class="p3"><span class="s1">Annotation files are only necessary if you would like to train your own behavior classifier (using the <i>trainModel</i> function). Annotation files should be stored in their own directory. You can either represent annotations in bout-level format or instance-level format.</span></p>
<p class="p3"><span class="s1">If using bout-level format, annotation files should be in csv format with the following fields: <i>identifier, StartDateTime, EndDateTime, behavior</i>. The <i>idenfitier</i> field should be the unique participant identifier (<i>e.g.</i>, “Participant01”). The <i>StartDateTime</i> and <i>EndDateTime</i> fields should be the start time and end time of the behavior, and can be formatted as either <i>mm/dd/yyyy HH:MM:SS</i> or <i>yyyy-mm-dd HH:MM:SS</i>. The <i>behavior</i> field is a string naming the behavior.</span></p>
<p class="p3"><span class="s1">If using instance-level format, the time steps must match the window size of the classifier you are using. Instance-level annotation files should be in csv format with the following fields: <i>identifier, timestamp, behavior</i>. The <i>idenfitier</i> field should be the unique participant identifier (<i>e.g.</i>, “Participant01”). The <i>timestamp</i> field should be the timestamp of the behavior, and should be formatted as <i>yyyy-mm-dd HH:MM:SS</i>. The <i>behavior</i> field is a string naming the behavior.</span></p>
<p class="p3"><span class="s1">You can either include all annotations in a single file, or have one file for each participant. If using a separate file for each participant, the file name should be the participant identifier (<i>e.g.</i>, “Participant01.csv”).</span></p>
<h2 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 33.0px; font: 30.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">Classifying data</span></h2>
<p class="p3"><span class="s1">Data from one or more devices can be classified with behavior labels using the <i>classify</i> function. You can either use a classifier you have trained yourself using the <i>trainModel</i> function, or one that has been pre-trained on one of our datasets. Pre-trained models that have been trained on three UCSD datasets are <a href="http://ieng9.ucsd.edu/~kellis/TLBC.html"><span class="s3">available for download</span></a>.</span></p>
<p class="p3"><span class="s1">Please see the documentation for the <i>classify</i> function for more details.</span></p>
<h2 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 33.0px; font: 30.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">Training models</span></h2>
<p class="p3"><span class="s1">You can train a classifier from your own data using the <i>trainModel</i> function. This requires data from either an accelerometer or GPS (or both) along with matched annotations of behaviors. Please see the documentation for the <i>trainModel</i> function for more details.</span></p>
<h2 style="margin: 0.0px 0.0px 10.0px 0.0px; line-height: 33.0px; font: 30.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333"><span class="s1">Calculating performance</span></h2>
<p class="p3"><span class="s1">If you have annoations for your data, you can check the performance of a classifier on your dataset by using the <i>calcPerformance</i> function. Please see the documentation for more details.</span></p>
</body>
</html>