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:


(duration) The bucket aggregation interval


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


(string) The implicit data sink for prediction saving


(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


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


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


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


(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) timeseries, or fingerprints


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


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


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