Get machine learning model

Gets the configuration and status of the specified machine learning model.

Required Permissions

Requires the MEMBER role or higher.

HTTP Request

GET /api/sonar/machine-learning/models/:guid
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     https://HOSTNAME/api/sonar/machine-learning/models/a1b2c3d4-e5f6-7890-abcd-ef1234567890
Request Parameters
Path Parameters
KeyTypeDescriptionNotes
guidStringMachine learning model identifier36 characters

Success Response

{
  "model": {
    "guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "random_forest",
    "type_name": "Random Forest",
    "user_guid": "11111111-2222-3333-4444-555555555555",
    "user_name": "admin",
    "name": "Anomalous Traffic Classifier",
    "description": "Network traffic anomaly detection model",
    "dataset_guid": "99999999-8888-7777-6666-555555555555",
    "dataset_name": "Traffic Learning Dataset",
    "fields": [
      {
        "name": "src_ip",
        "type": "string"
      },
      {
        "name": "label",
        "type": "string",
        "target": true,
        "values": ["normal", "anomaly"],
        "cardinality": 2,
        "importance": 0.83
      }
    ],
    "parameters": {
      "max_depth": "5",
      "n_estimators": "100"
    },
    "trained": true,
    "train_progress": 100.0,
    "schema": null,
    "accuracy": 0.95,
    "precision": 0.93,
    "recall": 0.91,
    "f1": 0.92,
    "confusion": [[120, 5], [8, 110]],
    "created": 1718668225000,
    "updated": 1718668225000
  }
}
  • model (Map): Machine learning model configuration
    • guid (String): Model identifier
    • type (String): Model type code
    • type_name (String): Localized model type name
    • user_guid (String): Identifier of the account that created the model
    • user_name (String): Name of the account that created the model
    • name (String): Model name
    • description (String): Model description
    • dataset_guid (String, nullable): Learning dataset identifier
    • dataset_name (String): Learning dataset name
    • fields (Array): Model field list
      • name (String): Field name
      • type (String): Field data type
      • target (Boolean, optional): Whether this is the target field. Present only when true
      • values (String array, optional): List of category values. Present only when set
      • cardinality (32-bit integer, optional): Number of category values. Present only when values is set
      • importance (64-bit float, optional): Field importance. Present only when greater than 0
    • parameters (Map): Hyperparameter key/value
    • trained (Boolean): Whether training is completed
    • train_progress (64-bit float): Training progress percentage
    • schema (Map, nullable): Model schema
    • accuracy (64-bit float): Accuracy
    • precision (64-bit float): Precision
    • recall (64-bit float): Recall
    • f1 (64-bit float): F1 score
    • confusion (Array, nullable): Confusion matrix as an array of 32-bit-integer arrays, where each row is [actual][expected]
    • created (Date): Creation time as epoch milliseconds
    • updated (Date): Last update time as epoch milliseconds

Error Responses

Required parameter is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "guid should be not null"
}
Identifier is not in GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "guid should be guid type."
}
Machine learning model does not exist

HTTP status code 200

{
  "model": null
}