# Feature Extraction - calculate slope

Having a bit of a mind-blank at the moment and am looking for some advice.

I am extracting features from time series data for input into a classification algorithm, for example I'm extracting average and variance from inputX.

For input Y, I have graphed the data and have seen that for class A, it can be seen that there is an upwards slope, and for class B, it can be seen that there is a downward slope, for class C there is no slope, the line is more or less straight. For Feature Extraction, how can I best describe this? Would a calculation to get positive/negative slope be best?

## 1 Answer

There are several ways to do this, here are a couple of options:

• Calculate different lag values (difference between now and t time units)
• Calculate a linear regression for different time windows and store the slope and the bias
• You can also involve higher order models to describe what is happening, if you think for example that the acceleration also matters you could use a 2nd or 3rd degree polynomial over the past couple of observations.