Create Model Commandedit

The create-model command will create a new model according to the settings defined in the input file:

loudml create-model avg_temp2.json

The avg_temp2.json file (Or .yml file if YAML format is used) may contain the following settings:

{
  "bucket_interval": "1m",
  "default_datasource": "my-datasource",
  "features": [
    {
      "default": 0,
      "field": "temp2",
      "measurement": "temperature_series",
      "metric": "avg",
      "name": "avg_temp_feature"
    }
  ],
  "interval": 60,
  "max_evals": 10,
  "name": "avg_temp2-model",
  "offset": 30,
  "span": 5,
  "max_threshold": 90,
  "min_threshold": 50,
  "type": "timeseries"
}

The supported settings are:

bucket_interval

(duration) The bucket aggregation interval

default_datasource

(string) The implicit data source to query and insert data

features

(array) An array of features, or dictionary of features, derived from the aggregated input data

interval

(duration) The periodic anomaly detection interval

max_evals

(integer) The integer number of iterations to produce a model with optimal accuracy

name

(string) Name of this model. This identifier must be unique

offset

(duration) The time offset used when querying the data source

seasonality

(dictionary) Enables daytime or weekday patterns detection in the model. Default is disabled.

forecast

(integer) The forecast horizon, defined as the number of time buckets to forecast when requesting the model to predict future data

span

(integer) The span interval, defined as the number of past time buckets to use as a proxy to predict future data

max_threshold

(integer) An anomaly threshold between 0 and 100. Anomalies start when this threshold is exceeded.

min_threshold

(integer) An anomaly threshold between 0 and 100. Anomalies end when the current scores fall behind this threshold

type

(string) timeseries

timestamp_field

(string) Optional. The main timestamp field in your TSDB data source. The default value for this field is timestamp. You can set the value to @timestamp or the value that fits your TSDB mapping.

This above example defines a unique feature, named avg_temp_feature that will be averaged over bucket_interval (1 minute) bucket intervals. The last 5 (span) buckets (5 * 1 minute) will be used for predicting future avg_temp_feature values.

Defining features is straightforward using the unique Loud ML feature description language

Note

The same instructions allow you to define both single variate (unique feature) and multivariate models.

Defining multiple features in the model opens the possiblity to find correlations between features automalically, and achieve a better accuracy in the predictions.

An example of using time series with distinct input and output features is available in the documentation.

Note

All features defined in the model will query and aggregate data from the same data source.

Please vote and let us know if you’d like us to implement native data aggregations and features across distinct data-sources: GitHub Aggregating from distinct data sources