Path: blob/main/activity_recognition.ipynb
336 views
Activity Recognition with Healthy Older People Using a Batteryless Wearable Sensor
This notebook provides code for loading the activity recognition dataset into a suitable format for classification and sequence labelling.
The code is divided into three sections:
Loading the data
Sequence labelling: processing the data into a suitable format for sequence labelling.
Classification: processing the data into a suitable format for use with an IID classifier.
We recommend running all three sections, then using the variables produced by the code as required for sequence labelling and IID classification.
Loading the Data
Run the following cells to load the data from disk. You will need to run code from the subsequent sections (or your own code) to get the data into a suitable format for classification and sequence labelling.
Sequence Labelling
The following cell creates two variables that you can use for sequence labelling:
X_by_seq is a list of 2-D numpy arrays. Each numpy array in this list corresponds to on data sequence and contains the input feature values for that sequence.
y_by_seq is a list of 1-D numpy arrays, where each array contains the target class labels for each sequence.
Variables for sequence labelling
The cell below produces the data you need for sequence labelling... You should be able to work with these variables directly.
You may find the following code useful for creating a sequence labelling model:
IID Classification
In this code, we take the X and y lists produced for sequence labelling, and concatenate the data points for all sequences. This produces a single set of training data and a single set of test data, which are not divided into separate sequences.