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:


(duration) The bucket aggregation interval


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


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


(duration) The periodic anomaly detection interval


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


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


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


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


(integer) The sliding window size, defined as the number of past time buckets


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


(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.


(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.


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


(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


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


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


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