The first task is to build a binary classifier to classify the activity of each time window into static (0) and dynamic (1), where static postural transitions are coounted as static (0). The second task is build a refined multi-class classifier to classify walking (1), walking_upstairs (2), walking_downstairs (3), sitting (4), standing (5), lying (6), and static postural transition (7).
For binary classificaton task, require R version 4.1.3, and following packages:
dplyr * 1.0.9
e1071 * 1.7-13
rpart * 4.1.1
tidytext * 0.4.1
tidyverse * 1.3.2
ipred * 0.9-14
The complete R session info can be found here
For multi-class task, the running environment is as follows:
OS info: Windows-10-10.0.22000-SP0
Python version: 3.10.9 | packaged by conda-forge | (main, Jan 11 2023, 15:15:40) [MSC v.1916 64 bit (AMD64)]
The package requirements are listed in requirements.txt
.
Note: To get training_data.txt, you need to unzip /data/training_data.zip
first.
In linux OS, you can use following commands:
cd ~/Biostat-626-mid1/data
unzip training_data.zip
In Mac OS, you can use following commands:
unzip train_data.zip -d ~/Biostat-626-mid1/data
In Windows OS, you can use any unzip software(e.g. Bandzip), to unzip the file under /data.
For binary classfication, please access to mid1_binary.Rmd
As I'm using jupyter notebook, you can simply get accesses to the result as it has already been saved.(But for the model you need to re-run it.)
For the best performed model, please access to mid1_multiclass-o.ipynb
For the last submitted model, please access to mid1_multiclass.ipynb
A group of volunteers, aged between 19 and 48, are recruited to participate in the experiment. They performed a protocol consisting of six activities: three static postures (standing, sitting, lying) and three dynamic activities (walking, walking downstairs, and walking upstairs). The experiment also recorded postural transitions that occurred between the static postures. These are: stand-to-sit, sit-to-stand, sit-to-lie, lie-to-sit, stand-to-lie, and lie-to-stand. All participants wore a smart device on the waist during the experiment. It captured 3-axial linear acceleration and 3-axial angular velocity at a constant rate of 50Hz using the embedded accelerometer and gyroscope of the device. In this context, the activities are considered outcomes, and the signals measured by the smart device are considered features.
The sensor signals (accelerometer and gyroscope) were pre-processed by applying noise filters and then sampled in fixed-width sliding windows of 2.56 sec and 50% overlap (128 readings/window). The sensor acceleration signal, which has gravitational and body motion components, was separated using a Butterworth low-pass filter into body acceleration and gravity. The gravitational force is assumed to have only low-frequency components. Therefore a filter with a 0.3 Hz cutoff frequency was used. From each window, a vector of 561 features was obtained by calculating variables from the time and frequency domain. The details of the 561 features are described in files data_dictionary.txt
and feature_info.txt
.
Two tab-delimited text files training_data.zip
and test_data.txt
are provided. The training data (labeled activity information included) should be used to construct and test your ML algorithms. Apply your algorithm to the test data (containing only feature information) and predict the activity corresponding to each time window.