Using adaptive filtering to predict the future time series value in Python

What is Adaptive filtering?

Adaptive filtering is a computational device that attempts to model the relationship between two signals, whose coefficients change with an objective to make the filter converge to an optimal state. The optimization criterion is a cost function, which is most commonly the mean square of the error between the output of the adaptive filter and the desired signal. The mean square error (MSE) will converge to its minimal value, while the filter adapts its coefficients. The figure below demonstrates the simple adaptive filter.

Image for post

Simple adaptive filter toolbox

The adaptive filter will try to match the filter output, y(k), with the desired signal, d(k). The adaptive filter will also learn using the error, e(k), and adjust the coefficient. Hence, it is adapted to the new environment, input x(k).

This brings us to the main feature of adaptive filtering, which is it has the **real-time capability to adjust the response with the intent to improve its performance **(sounds like self-learning, anyone?). The adaptation algorithm is implemented through two methods; gradient method and least square (LMS, RLS algorithm).

What is it for?

If you have studied any digital signal and processing courses, you will see most of the adaptive filter application on identifying an unknown communications channel, canceling noise or interference, or predicting the future values of a periodic signal.

So how we can use it in a business setting?

Based on the last example of the digital use case, we can apply the concept to predict future values in real-time settings, for example; stock price prediction. However, predicting the future using this approach requires several key assumptions; the data is either steady or slowly varying over time, and periodic overtime as well.

Accepting these assumptions, the adaptive filter must predict the future values of the desired output based on past input values. Hence, we need to structure the delay in the input signal and feed them to the adaptive filter system.

Image for post

Predicting future values using an adaptive filter

As stated earlier, the adaptive filter is used to identify and understand the unknown system, we can use this to identify and predict the time series behavior.

#python #data-science #machine-learning #time-series-analysis #adaptive-filtering

Time Series prediction using Adaptive filtering
6.95 GEEK