Creating a Model
Create and then train a model in Anomaly Detection.
You can create the model in an existing project or create a project for it.
Example API Calls
You can use the following Anomaly Detection service API calls to help you to create and train models.
-
Create an AI project:
Endpoint: https://anomalydetection.aiservice.us-phoenix-1.oci.oraclecloud.com/20210101/projects Method: POST Body: { "displayName":"Test Anomaly Detection", "compartmentId": "ocid1.compartment.oc1..aaaaaaaaaqf4b7xq6kxrr…..jpbdfmcjmzdufz6sy52pra", "description" : "PROJECT FOR ANOMALY DETECTION" }
-
Create a data assets, which assumes that the data is already in OCI Object Storage:
Endpoint: https://anomalydetection.aiservice.us-phoenix-1.oci.oraclecloud.com/20210101/dataAssets Method: POST Body: { "displayName" : "sample dataAsset", "compartmentId" : "ocid1.compartment.oc1..aaaaaaaaaqf4b7xq6kxrrbl…..pbdfmcjmzdufz6sy52pra", "projectId" : "ocid1.aiproject.oc1.iad.amaaaaaaor7l3jiauulbiu5dtqga….eksq3ophqwxsiyuf4q", "description" : "oracle object storage data asset", "dataSourceDetails" : { "dataSourceType" : "ORACLE_OBJECT_STORAGE", "bucketName" : "mset_service_model_storage", "namespace" : "namespace_bucket", "objectName" : "ValidTrainingData.json" } }
-
Train the model.
-
Univariate Model Example
Endpoint: https://anomalydetection.aiservice.us-phoenix-1.oci.oraclecloud.com/20210101/models Method: POSTBody:{ "compartmentId": "ocid1.compartment.oc1..aaaaaaaaaqf4b7xq6kxrrb…..rcmjpbdfmcjmzdufz6sy52pra", "displayName": "ashburn_data_center", "description": "Ashburn Data center model", "projectId": "ocid1.aianomalydetectionproject.oc1.phx.amaaaaaaukxuveqahqmhksgwsdf5w7unr75nrk4cevclqitd6nkroltlr34q", "modelTrainingDetails": { "targetFap": 0.05, "trainingFraction": 0.7, "algorithmHint": "UNIVARIATE_OCSVM", "dataAssetIds": [ "ocid1.aianomalydetectiondataasset.oc1.phx.amaaaaaaukxuveqaun27l3qyrcdz5bofrezezf6sivlhk6kxhnj6dnkzqyea" ] } }
-
Multivariate Model Example
Endpoint: https://anomalydetection.aiservice.us-phoenix-1.oci.oraclecloud.com/20210101/models Method: POST Body:{ "compartmentId": "ocid1.compartment.oc1..aaaaaaaaaqf4b7xq6kxrrb…..rcmjpbdfmcjmzdufz6sy52pra", "displayName": "ashburn_data_center", "description": "Ashburn Data center model", "projectId": "ocid1.aianomalydetectionproject.oc1.phx.amaaaaaaukxuveqahqmhksgwsdf5w7unr75nrk4cevclqitd6nkroltlr34q", "modelTrainingDetails": { "targetFap": 0.05, "trainingFraction": 0.7, "algorithmHint": "MULTIVARIATE_MSET", "dataAssetIds": [ "ocid1.aianomalydetectiondataasset.oc1.phx.amaaaaaaukxuveqaun27l3qyrcdz5bofrezezf6sivlhk6kxhnj6dnkzqyea" ] }
-
-
We recommend this approach to create and train anomaly detection models into existing applications to implement in production.
Example API Calls
You can use the following Anomaly Detection service API calls to help you to create and train models.
-
Create an AI project:
Endpoint: https://anomalydetection.aiservice.us-phoenix-1.oci.oraclecloud.com/20210101/projects Method: POST Body: { "displayName":"Test Anomaly Detection", "compartmentId": "ocid1.compartment.oc1..aaaaaaaaaqf4b7xq6kxrr…..jpbdfmcjmzdufz6sy52pra", "description" : "PROJECT FOR ANOMALY DETECTION" }
-
Create a data assets, which assumes that the data is already in OCI Object Storage:
Endpoint: https://anomalydetection.aiservice.us-phoenix-1.oci.oraclecloud.com/20210101/dataAssets Method: POST Body: { "displayName" : "sample dataAsset", "compartmentId" : "ocid1.compartment.oc1..aaaaaaaaaqf4b7xq6kxrrbl…..pbdfmcjmzdufz6sy52pra", "projectId" : "ocid1.aiproject.oc1.iad.amaaaaaaor7l3jiauulbiu5dtqga….eksq3ophqwxsiyuf4q", "description" : "oracle object storage data asset", "dataSourceDetails" : { "dataSourceType" : "ORACLE_OBJECT_STORAGE", "bucketName" : "mset_service_model_storage", "namespace" : "namespace_bucket", "objectName" : "ValidTrainingData.json" } }
-
Train the model.
-
Univariate Model Example
Endpoint: https://anomalydetection.aiservice.us-phoenix-1.oci.oraclecloud.com/20210101/models Method: POSTBody:{ "compartmentId": "ocid1.compartment.oc1..aaaaaaaaaqf4b7xq6kxrrb…..rcmjpbdfmcjmzdufz6sy52pra", "displayName": "ashburn_data_center", "description": "Ashburn Data center model", "projectId": "ocid1.aianomalydetectionproject.oc1.phx.amaaaaaaukxuveqahqmhksgwsdf5w7unr75nrk4cevclqitd6nkroltlr34q", "modelTrainingDetails": { "targetFap": 0.05, "trainingFraction": 0.7, "algorithmHint": "UNIVARIATE_OCSVM", "dataAssetIds": [ "ocid1.aianomalydetectiondataasset.oc1.phx.amaaaaaaukxuveqaun27l3qyrcdz5bofrezezf6sivlhk6kxhnj6dnkzqyea" ] } }
-
Multivariate Model Example
Endpoint: https://anomalydetection.aiservice.us-phoenix-1.oci.oraclecloud.com/20210101/models Method: POST Body:{ "compartmentId": "ocid1.compartment.oc1..aaaaaaaaaqf4b7xq6kxrrb…..rcmjpbdfmcjmzdufz6sy52pra", "displayName": "ashburn_data_center", "description": "Ashburn Data center model", "projectId": "ocid1.aianomalydetectionproject.oc1.phx.amaaaaaaukxuveqahqmhksgwsdf5w7unr75nrk4cevclqitd6nkroltlr34q", "modelTrainingDetails": { "targetFap": 0.05, "trainingFraction": 0.7, "algorithmHint": "MULTIVARIATE_MSET", "dataAssetIds": [ "ocid1.aianomalydetectiondataasset.oc1.phx.amaaaaaaukxuveqaun27l3qyrcdz5bofrezezf6sivlhk6kxhnj6dnkzqyea" ] }
-
-