When looking at time series data, such as a stream of prices, it can often be useful to establish a general trend and represent this with a single number. This can be achieved using a linear regression calculation.
Take this series of prices:
4.8, 4.8, 4.5, 3.9, 4.4, 3.6, 3.6, 2.9, 3.5, 3.0, 2.5, 2.2, 2.6, 2.1, 2.2
If you plot on an Excel graph and add a linear trend line, you should get something like this:
We can do the same thing in code:
Now you have the slope of the trend line, this can be used as an input for neural networks analysing time series data.
For a complete explanation of linear regression see Wikipedia.
Contact us if you would like to learn more about using AI and machine learning in your business.
Or, follow us on Twitter for more updates like this.