---
title: "Train a Multivariate Anomaly Detection Model"
method: POST
path: "/multivariate/models"
---

# Train a Multivariate Anomaly Detection Model

`POST /multivariate/models`

Create and train a multivariate anomaly detection model. The request must
include a source parameter to indicate an Azure Blob
Storage URI that's accessible to the service. There are two types of data input. The Blob Storage URI can point to an Azure Blob
Storage folder that contains multiple CSV files, where each CSV file has
two columns, time stamp and variable. Or the Blob Storage URI can point to a single blob that contains a CSV file that has all the variables and a
time stamp column.
The model object will be created and returned in the response, but the
training process happens asynchronously. To check the training status, call
GetMultivariateModel with the modelId value and check the status field in the
modelInfo object.

## Request body

- MultivariateModelInfo — Training result of a model, including its status, errors, and diagnostics information.
  - `dataSource` string, uri, required — Source link to the input data to indicate an accessible Azure Storage URI. It either points to an Azure Blob Storage folder or points to a CSV file in Azure Blob Storage, based on your data schema selection.
  - `dataSchema` 'OneTable' | 'MultiTable' — Data schema of the input data source. The default is OneTable.
  - `startTime` string, date-time, required — Start date/time of training data, which should be in ISO 8601 format.
  - `endTime` string, date-time, required — End date/time of training data, which should be in ISO 8601 format.
  - `displayName` string — Display name of the model. Maximum length is 24 characters.
  - `slidingWindow` integer — Number of previous time stamps that will be used to detect whether the time stamp is an anomaly or not.
  - `alignPolicy` MultivariateAlignPolicy — Manner of aligning multiple variables.
    - `alignMode` 'Inner' | 'Outer'
    - `fillNAMethod` 'Previous' | 'Subsequent' | 'Linear' | 'Zero' | 'Fixed' — Field that indicates how missing values will be filled.
    - `paddingValue` number, float — Field that's required when fillNAMethod is Fixed.
  - `status` 'CREATED' | 'RUNNING' | 'READY' | 'FAILED'
  - `errors` MultivariateErrorResponse[] — Error messages after failure to create a model.
    - `code` string, required — Error code.
    - `message` string, required — Message that explains the error that the service reported.
  - `diagnosticsInfo` MultivariateDiagnosticsInfo — Diagnostics information to help inspect the states of a model or variable.
    - `modelState` MultivariateModelState — Model status.
      - `epochIds` integer[] — Number of passes of the entire training dataset that the algorithm has completed.
      - `trainLosses` number[] — List of metrics used to assess how the model fits the training data for each epoch.
      - `validationLosses` number[] — List of metrics used to assess how the model fits the validation set for each epoch.
      - `latenciesInSeconds` number[] — Latency for each epoch.
    - `variableStates` MultivariateVariableState[] — Variable status.
      - `variable` string — Variable name in variable states.
      - `filledNARatio` number, float — Proportion of missing values that need to be filled by fillNAMethod.
      - `effectiveCount` integer — Number of effective data points before fillNAMethod is applied.
      - `firstTimestamp` string, date-time — First valid time stamp with a value of input data.
      - `lastTimestamp` string, date-time — Last valid time stamp with a value of input data.

## Response `201`

The request has succeeded and a new resource has been created as a result.

- MultivariateAnomalyDetectionModel — Response of getting a model.
  - `modelId` string, uuid, required — Universally Unique Identifier
  - `createdTime` string, date-time, required — Date and time (UTC) when the model was created.
  - `lastUpdatedTime` string, date-time, required — Date and time (UTC) when the model was last updated.
  - `modelInfo` MultivariateModelInfo — Training result of a model, including its status, errors, and diagnostics information.
    - `dataSource` string, uri, required — Source link to the input data to indicate an accessible Azure Storage URI. It either points to an Azure Blob Storage folder or points to a CSV file in Azure Blob Storage, based on your data schema selection.
    - `dataSchema` 'OneTable' | 'MultiTable' — Data schema of the input data source. The default is OneTable.
    - `startTime` string, date-time, required — Start date/time of training data, which should be in ISO 8601 format.
    - `endTime` string, date-time, required — End date/time of training data, which should be in ISO 8601 format.
    - `displayName` string — Display name of the model. Maximum length is 24 characters.
    - `slidingWindow` integer — Number of previous time stamps that will be used to detect whether the time stamp is an anomaly or not.
    - `alignPolicy` MultivariateAlignPolicy — Manner of aligning multiple variables.
      - `alignMode` 'Inner' | 'Outer'
      - `fillNAMethod` 'Previous' | 'Subsequent' | 'Linear' | 'Zero' | 'Fixed' — Field that indicates how missing values will be filled.
      - `paddingValue` number, float — Field that's required when fillNAMethod is Fixed.
    - `status` 'CREATED' | 'RUNNING' | 'READY' | 'FAILED'
    - `errors` MultivariateErrorResponse[] — Error messages after failure to create a model.
      - `code` string, required — Error code.
      - `message` string, required — Message that explains the error that the service reported.
    - `diagnosticsInfo` MultivariateDiagnosticsInfo — Diagnostics information to help inspect the states of a model or variable.
      - `modelState` MultivariateModelState — Model status.
        - `epochIds` integer[] — Number of passes of the entire training dataset that the algorithm has completed.
        - `trainLosses` number[] — List of metrics used to assess how the model fits the training data for each epoch.
        - `validationLosses` number[] — List of metrics used to assess how the model fits the validation set for each epoch.
        - `latenciesInSeconds` number[] — Latency for each epoch.
      - `variableStates` MultivariateVariableState[] — Variable status.
        - `variable` string — Variable name in variable states.
        - `filledNARatio` number, float — Proportion of missing values that need to be filled by fillNAMethod.
        - `effectiveCount` integer — Number of effective data points before fillNAMethod is applied.
        - `firstTimestamp` string, date-time — First valid time stamp with a value of input data.
        - `lastTimestamp` string, date-time — Last valid time stamp with a value of input data.

## Other responses

- `default` — An unexpected error response.

---

[API](https://skmtc.net/azure/apis/cognitiveservices-anomalydetector.md) · [All operations](https://skmtc.net/azure/apis/cognitiveservices-anomalydetector/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/cognitiveservices-anomalydetector/versions/3d72cecb974e/schema)
