AI Sub-functions of the DBMind-Forecast
Tags: opengauss
Published: 2023-04-13 03:56:23

**Overview**

The trend prediction module predicts the future time series change trend based on historical time series data. The framework of this module has been decoupled to flexibly change prediction algorithms. This module can automatically select algorithms for different feature time series. The LR regression algorithm for linear feature time series prediction and the ARIMA algorithm for non-linear feature prediction are supported. At present, this module can cover the accurate prediction of linear time series, non-linear time series and periodic time series.

**Environment Deployment**

The metric collection system is running properly.

**Usage Guide**

Assume that the **confpath** configuration file directory has been initialized.

**·** To enable only the trend prediction function, run the following command (for details, see the description of the **service** subcommand):

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l63oqjkblf63n9j02ol1.png)

**·** To enable trend prediction in interactive mode, run the following command and view the prediction result of an instance metric from **timestamps0** to **timestamps1**:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vtf1og2kn01pe5hfm1qk.png)

**·** Run the following command to manually clear historical prediction results:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgz8hn0q655aygi09zh7.png)

**·** To enable trend prediction based on the user-defined threshold (up and low), run the following command and view the prediction result of the metric of an instance from timestamps0 to timestamps1 and check whether the prediction value exceeds the threshold:

gs_dbmind component forecast early-warning -c confpath --metric-name metric --host instance --start-time timestamps0 --end-time timestamps1 --upper up --lower low

**·** Run the following command to stop the services that have been started:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9pnuyw9ga4l0zqadnjz.png)

**Obtaining Help Information**

You can run the **–help** command to obtain the help information. For example:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qdyv2gn7bebgr9v0zkvy.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gonxy464wnh4nvhypa0y.png)

**Command Reference**

Table 1 Parameters of the gs_dbmind component forecast command line

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjre0ytokncth17sutfk.png)

**Troubleshooting**
**·** Considering the actual service and model prediction effect, you are advised to set the trend prediction duration to a value greater than 3600 seconds. (If the metric collection period is 15 seconds, the number of data records collected is 240.) Otherwise, the prediction effect will deteriorate, and the service will be abnormal when the data volume is extremely small. The default value is 3600 seconds.
**·** After the parameters in the configuration file are reset, you need to restart the service process for the settings to take effect.