Human Activity Recognition

Original article was published by sridhar p on Deep Learning on Medium


Let’s jump into the data set we have,

  1. Need to build 6 class classifier
  2. breaking the time series up into each window and Convert into vector (first vector)after applying filter on top it.
  3. for second vector ,we need to do overlapping previous window by half and so on we need to calculate the vector for each window.
Credits:Google

Original data:

Accelerometer : x,y,z

gyroscope : x,y,z

totally we have six time series data

Domain expert data:

Domain expert has played very import role to featuring the data.

This case study trade off between

  1. human expert engineering feature

Here we are building classical ML model

2.Raw Time series data

Here we are building Deep learning model. Because, we know RNN can handle time series data

will see how classified model would be as compared to deep learning model

If you want to solve problem like this you should consult with domain expert in the particular field.

Or else, we can deep learning model to solve this problem

Next Question will be,

How do we break the data?

Ok, let’s do some EDA using this data set

Observations:

We have got almost same number of reading from all the subjects

Observations:

This data is mostly balanced

Featuring Engineering from Domain Knowledge

  • Static and Dynamic Activities
  • In static activities (sit, stand, lie down) motion information will not be very useful.
  • In the dynamic activities (Walking, Walking Upstairs, Walking Downstairs) motion info will be significant.

Stationary and Moving activities are completely different

Magnitude of an acceleration can separate it well

Observations:

  • If tAccMean is < -0.8 then the Activities are either Standing or Sitting or Laying.
  • If tAccMean is > -0.6 then the Activities are either Walking or WalkingDownstairs or WalkingUpstairs.
  • If tAccMean > 0.0 then the Activity is WalkingDownstairs.
  • We can classify 75% the Acitivity labels with some errors.

Position of Gravity Acceleration Components also matters

Observations:

  • If angleX, gravityMean > 0 then Activity is Laying.
  • We can classify all data points belonging to Laying activity with just a single if else statement.

Apply t-sne on the data

We have converted 561 dimension into 2 dimension

Observations:

First thing we should notice that most of the points are fairly separated expect sitting and standing.

The challenge is to separate sitting and standing features

Also , I would like to know what changes will happen if perplexity value changes

Observation:

Each data points are well separated expect standing and sitting.

Observation:

Even changing More perplexity output remains the same.

Building a Classical Machine learning Models

Here we have used 561 expert engineered features,

Observation:

12% of sitting points are classified as standing

Conclusion

We can choose Logistic regression or Linear SVC or rbf SVM.