# Trend Prediction Service¶

## Idea¶

The Trend Prediction Service predicts future values for time series using linear and nonlinear regression models. It is a forecasting framework, that has many useful applications in the area of Process & Condition Monitoring.

The service enables the user to run the following applications:

• Predictive maintenance: A component's lifetime may be reached in the short-term future.
• Monitoring of processes: Prediction of remaining time to prevent unwanted process states.
• Seasonality and trend removal as preparation for other data analytics tasks.

## Basics¶

The Prediction Service is a data-driven approach that can be applied to univariate (single input variable) or multivariate (multiple input variables) time-series data. The predicted output is always univariate and written to a single target variable.

The service provides the functionality required for estimating the relationships between the variables of a given time series in order to make predictions based on the trained model. These predictions can then be used for reasoning about the process represented by the time series.

The trained models are based on a linear or polynomial regression.

### Linear regression¶

Linear regression assumes a linear dependence between a single target variable (y) and one (e.g., time) or several independent input variables (x1, x2, …):

y = b0 + b1x1 + b2x2 + … + bnxn

For a single independent variable x, we have a model like y = b0 + b1x1.

While not very complex, the approach has proven to be a powerful method for early detection of the potential faults. The results produced by the algorithm are both easy to interpret and visualize.

In the case of the multivariate input, the algorithm expects that all independent variables are available at any time.

### Polynomial regression¶

Polynomial regression assumes a polynomial (of a given degree) dependence between a single target variable (y) and one (e.g., time) or several independent input variables.

For a single independent variable x, the relationship is given by y = b0 + b1x + b2x2 + … + bnxn.

For a 3 independent variables x and a polynomial degree of 2, we have a model like y = b0 + b1x12 + b2x22 + b3x32 + b12x1x2 + b13x1x3 + b23x2x3.

This approach may capture more complex relationships between the variables than a linear model at the expense of an increased computational complexity and a need of specifying the degree of a polynomial to be fitted.

In the case of the multivariate input, the algorithm expects that all independent variables are available at any time.

## Features¶

The Trend Prediction Service exposes its API for realizing the following tasks:

• Train (fit) a regression model.
• Predict future values.
• Train & predict in one request.
• Get all regression models of an entity.
• Get a regression model by ID.
• Delete a regression model.

## Example Scenario¶

The manager of a brewery wants to predict the yearly energy consumption of his new production line.

Collect time series data with the relevant energy consumption of the new production line. Feed the Trend Prediction Service API with this time series and evaluate the predicted future consumption.

### Requirements¶

• The production line is connected to MindSphere.