A class project for CS390MB: Mobile Health Sensing and Analytics. A scikit-learn decision tree classifier for classifying activities: Sitting, Walking, Running, Jumping.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
.gitignore
activity-classification-train.py
activity-recognition.py
classifier.pickle
collect-labelled-activity-data.py
features.py
license.txt
readme.md
util.py

readme.md

CS 390MB Fall 2016 Group 2 A2 Part 4

A project for CS390MB - Mobile Health Sensing and Monitoring

Assignment Description

Starter Code (features.py, util.py, activity-recognition-train.py, collect-labelled-activity-data.py, activity-recognition.py)

Instructor: Deepak Ganesan

Description

This trains a decision tree classifier to identify activities based on accelerometer data. This is meant to be used via an app and a server. The server is now down so the server data gathering and prediction functionality won't work. However, it is still possible to train and evaluate the classifier with some data that has already been gathered.

Student Implementations

All student implementations are surrounded with comments.

activity-classification-train.py

Training within k-fold validation loop as well as accuracy, precision, and recall calculations.

activity-recognition.py

Implementation of predict function.

features.py

All feature extaction except _compute_mean_features

Usage

To get labeled data from the server saved to a csv

This will not work since the server is not currently running. If the server were running data could be collected and appened to data/my-activity-data.csv like so:

python collect-labelled-activity-data.py

This stores data in a file called my-activity-data.csv in the current directory. This is done in a section we can't change.

To train the classifier

To train on data from data/my-activity-data.csv:

python activity-classification-train.py

This will train the classifier and serialize it into a pickle file called classifier.pickle. It will overwrite the file since it is there already.

To do server-side prediction

This will not work since the server is not currently running. If the server were running, make sure you have a classifier in classifier.pickle and run:

python activity-recognition.py

Files

data/my-activity-data.csv

Labeled data.

activity-classification-train.py

Trains a decision tree classifier on data from data/my-activity-data.csv and serializes the classifier to classifier.pickle.

activity-recognition.py

Handles server-side activity recognition.

classifier.pickle

A serialization of the classifier.

collect-labelled-activity-data.py

Server side data collection.

features.py

Extracts features.

util.py

Instructor provided this to handle windows.