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": "donut"
}

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

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 sliding window size, defined as the number of past time buckets

grace_period

(duration) A grace period interval to ignore new anomalies immediately after a new anomaly. Default value is zero (disabled)

max_threshold

(integer) An anomaly threshold between 0 and 100. Anomalies start when this threshold is exceeded. An optimal value will be set automatically if the threshold is set to zero.

min_threshold

(integer) An anomaly threshold between 0 and 100. Anomalies end when the current scores fall behind this threshold. An optimal value will be set automatically if the threshold is set to zero.

type

(string) donut, or a custom type if you extend Loud ML using new model types

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 OSS version supports one unique feature per model to keep things simple.

Depending on where you are in your ML journey, having more than one feature in the model opens the possiblity to find correlations and use ML for more challenging questions in industrial IoT and other domains. For a quick chat with our experts: Contact Us

Note

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

Note

The offset parameter is equivalent to Elasticsearch index.refresh_interval parameter.

This parameter takes into account the fact that all data will not hit the TSDB in real time and cannot be consumed immediately.

Loud ML automatically applies a negative time offset to all TSDB queries, eg if you set offset=30s and your query ranges from now-2d to now, then loudml will query the TSDB between now-2d and now-30s