Skip to main content

Job and Latest Model Metrics

POST /api/v2/metrics/job_and_latest_model

Description

The job_and_latest_model endpoint retrieves combined metrics for a job and its currently deployed model. This endpoint provides comprehensive performance data that includes both job-level statistics and the active model's performance metrics. As part of the request, the metrics of the model will be also recomputed and updated.

Quick Start Examples

Get metrics for a job and its active model

curl -X POST "https://your.arcanna.ai/api/v2/metrics/job_and_latest_model?job_id=1234" \
-H "X-Arcanna-Api-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{}'

Get metrics with custom time range

curl -X POST "https://your.arcanna.ai/api/v2/metrics/job_and_latest_model?job_id=1234&start_datetime=2025-01-01T00:00:00Z&end_datetime=2025-01-02T00:00:00Z" \
-H "X-Arcanna-Api-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{}'

Get metrics with custom timeout

curl -X POST "https://your.arcanna.ai/api/v2/metrics/job_and_latest_model?job_id=1234&timeout_s=300" \
-H "X-Arcanna-Api-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{}'

Get metrics with filters

curl -X POST "https://your.arcanna.ai/api/v2/metrics/job_and_latest_model?job_id=1234" \
-H "X-Arcanna-Api-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"filters": [
{
"field": "arcanna.result_label",
"operator": "is",
"value": "Escalate"
}
]
}'

Request Parameters

Query Parameters

ParameterTypeRequiredDescription
job_idinteger or stringYesThe ID of the job to retrieve metrics for
start_datetimestringNoStart date for metrics (ISO 8601 format)
end_datetimestringNoEnd date for metrics (ISO 8601 format)
timeout_sintegerNoMaximum wait time (in seconds) for refreshing model metrics. Default is 120

Request Body (Optional)

{
"filters": [
{
"field": "string",
"operator": "string",
"value": "string"
}
]
}

Filter Parameters:

  • field: The specific data field to apply the filter to
  • operator: Comparison method ('is', 'is not', 'contains', 'exists', 'gt', 'lt', etc.)
  • value: The criteria used by the operator to filter the field

Response

Success Response (200 OK)

{
"job_id": 1234,
"model_id": "generic-1-1234-model-1747385873.hdf5",
"job_metrics": {
"confusion_matrix": [
[4490, 0, 0],
[0, 749, 0],
[0, 0, 37]
],
"overall_accuracy": 1.0,
"overall_f1_score": 1.0,
"overall_recall": 1.0,
"overall_precision": 1.0,
"metrics_per_decision": {
"Drop": {
"precision": 1.0,
"recall": 1.0,
"f1_score": 1.0,
"true_positives": 4490,
"true_negatives": 786,
"false_positives": 0,
"false_negatives": 0
},
"Investigate": {
"precision": 1.0,
"recall": 1.0,
"f1_score": 1.0,
"true_positives": 749,
"true_negatives": 4527,
"false_positives": 0,
"false_negatives": 0
},
"Escalate": {
"precision": 1.0,
"recall": 1.0,
"f1_score": 1.0,
"true_positives": 37,
"true_negatives": 5239,
"false_positives": 0,
"false_negatives": 0
}
},
"start_time": "2025-01-01T00:00:00Z",
"end_time": "2025-01-02T00:00:00Z",
"time_saved_minutes": 1250.5,
"active_model_id": "generic-1-1234-model-1747385873.hdf5",
"all_model_ids": ["generic-1-1234-model-1747385873.hdf5"],
"total_events": 5276,
"total_events_in_knowledge_base": 2516,
"total_events_with_consensus": 5,
"changed_consensus_after_training": {
"total_events": 0,
"top_events_ids": [],
"top_buckets_ids": []
}
},
"model_metrics": {
"confusion_matrix": [
[4490, 0, 0],
[0, 749, 0],
[0, 0, 37]
],
"overall_accuracy": 1.0,
"overall_f1_score": 1.0,
"overall_recall": 1.0,
"overall_precision": 1.0,
"metrics_per_decision": {
"Drop": {
"precision": 1.0,
"recall": 1.0,
"f1_score": 1.0,
"true_positives": 4490,
"true_negatives": 786,
"false_positives": 0,
"false_negatives": 0
},
"Investigate": {
"precision": 1.0,
"recall": 1.0,
"f1_score": 1.0,
"true_positives": 749,
"true_negatives": 4527,
"false_positives": 0,
"false_negatives": 0
},
"Escalate": {
"precision": 1.0,
"recall": 1.0,
"f1_score": 1.0,
"true_positives": 37,
"true_negatives": 5239,
"false_positives": 0,
"false_negatives": 0
}
},
"model_id": "generic-1-1234-model-1747385873.hdf5",
"is_recomputing_metrics": false,
"last_recomputed_timestamp": "2025-01-15T10:30:00Z",
"kb_count_per_decision": {
"Drop": {
"alerts_count": 2066,
"buckets_count": 10
},
"Investigate": {
"alerts_count": 429,
"buckets_count": 5
},
"Escalate": {
"alerts_count": 21,
"buckets_count": 4
}
},
"buckets_in_kb": 19,
"events_in_kb": 2516
}
}

Error Response (404 Not Found)

{
"error": "Job or model not found"
}

Response Fields

Top-Level Fields

  • job_id: The ID of the job
  • model_id: The ID of the currently active model
  • job_metrics: Object containing job-level performance metrics
  • model_metrics: Object containing model-specific performance metrics

Job Metrics Object

  • confusion_matrix: 2D array representing the confusion matrix of model decisions
  • overall_accuracy: Mean accuracy across all decisions (0-1)
  • overall_f1_score: Mean F1 score across all decisions (0-1)
  • overall_recall: Mean recall across all decisions (0-1)
  • overall_precision: Mean precision across all decisions (0-1)
  • metrics_per_decision: Object containing metrics for each decision type:
    • precision: Precision score for this decision type
    • recall: Recall score for this decision type
    • f1_score: F1 score for this decision type
    • true_positives: Number of true positive predictions
    • true_negatives: Number of true negative predictions
    • false_positives: Number of false positive predictions
    • false_negatives: Number of false negative predictions
  • start_time: Start time for the computed metrics period
  • end_time: End time for the computed metrics period
  • time_saved_minutes: Estimated time saved by Arcanna (in minutes)
  • active_model_id: ID of the currently active model
  • all_model_ids: List of all model IDs associated with this job
  • total_events: Total number of events processed
  • total_events_in_knowledge_base: Number of events in the knowledge base
  • total_events_with_consensus: Number of events with consensus
  • changed_consensus_after_training: Object containing information about events that changed consensus after training
    • total_events: Total number of events that changed consensus
    • top_events_ids: List of top 10 events IDs that changed consensus
    • top_buckets_ids: List of top 10 buckets IDs that changed consensus

Model Metrics Object

  • confusion_matrix: 2D array representing the confusion matrix of model decisions
  • overall_accuracy: Mean accuracy across all decisions (0-1)
  • overall_f1_score: Mean F1 score across all decisions (0-1)
  • overall_recall: Mean recall across all decisions (0-1)
  • overall_precision: Mean precision across all decisions (0-1)
  • metrics_per_decision: Object containing detailed metrics for each decision type
  • model_id: The unique identifier of the model
  • is_recomputing_metrics: Boolean indicating if metrics are currently being recomputed
  • last_recomputed_timestamp: Timestamp of the last metrics recomputation
  • kb_count_per_decision: Object containing knowledge base counts for each decision type:
    • alerts_count: Number of alerts in the knowledge base for this decision
    • buckets_count: Number of buckets in the knowledge base for this decision
  • buckets_in_kb: Total number of buckets in the knowledge base
  • events_in_kb: Total number of events in the knowledge base

Important Notes

Automatic Model Metrics Refresh

  • This endpoint automatically triggers a refresh of the model metrics as part of the request
  • The timeout_s parameter controls how long to wait for the refresh to complete
  • If the refresh takes longer than the timeout, the endpoint returns the last known metrics

Combined View Benefits

  • Provides both job-level and model-level metrics in a single request
  • Ensures model metrics are up-to-date through automatic refresh
  • Ideal for comprehensive performance analysis and reporting