---
title: "Anomaly metadata"
method: GET
path: "/api/{projectId}/training/anomaly/{learnId}/metadata"
tags: ["Learn"]
---

# Anomaly metadata

`GET /api/{projectId}/training/anomaly/{learnId}/metadata`

## Request

- Base URL: `https://studio.edgeimpulse.com/v1`
- URL: `https://studio.edgeimpulse.com/v1/api/{projectId}/training/anomaly/{learnId}/metadata`
- Auth: one of:
  - API key in header `x-api-key`
  - API key in cookie `jwt`
  - API key in header `x-jwt-token`
  - OAuth 2
    - Authorization code: `/v1/oauth/authorize`
    - Client credentials
    - Implicit: `/v1/oauth/authorize`
    - Password
    - Token URL: `/v1/oauth/token`
- TypeScript: <https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/docs/api/:projectId/training/anomaly/:learnId/metadata/get.ts> (a function with typed inputs; its response is checked against the schema)

Get metadata about a trained anomaly block. Use the impulse blocks to find the learnId.

## Path parameters

- `projectId` integer, required
- `learnId` integer, required

## Response `200`

OK

- AnomalyModelMetadataResponse
  - `success` boolean, required: Whether the operation succeeded
  - `error` string: Optional error description (set if 'success' was false)
  - `created` string, date-time, required: Date when the model was trained
  - `scale` number[], required: Scale input for StandardScaler. Values are scaled like this (where `ix` is axis index): `input[ix] = (input[ix] - mean[ix]) / scale[ix];`
  - `mean` number[], required: Mean input for StandardScaler. Values are scaled like this (where `ix` is axis index): `input[ix] = (input[ix] - mean[ix]) / scale[ix];`
  - `clusters` object[], required: Trained K-means clusters
    - `center` number[], required: Center of each cluster (one value per axis)
    - `maxError` number, required: Size of the cluster
  - `axes` integer[], required: Which axes were included during training (by index)
  - `defaultMinimumConfidenceRating` number, required: DEPRECATED, see "thresholds" instead. Default minimum confidence rating required before tagging as anomaly, based on scores of training data (GMM only).
  - `availableModelTypes` KerasModelTypeEnum[]: The types of model that are available
  - `recommendedModelType` 'int8' | 'float32' | 'akida' | 'requiresRetrain'
  - `modelValidationMetrics` KerasModelMetadataMetrics[]: Metrics for each of the available model types
    - `type` 'int8' | 'float32' | 'akida' | 'requiresRetrain', required
    - `loss` number, required: The model's loss on the validation set after training
    - `accuracy` number: The model's accuracy on the validation set after training
    - `confusionMatrix` array[], required
      - number[]
    - `report` object, required: Precision, recall, F1 and support scores
    - `onDevicePerformance` object[], required
      - `mcu` string, required
      - `name` string, required
      - `isDefault` boolean, required
      - `latency` number, required
      - `tflite` object, required
        - `ramRequired` integer, required
        - `romRequired` integer, required
        - `arenaSize` integer, required
        - `modelSize` integer, required
      - `eon` object, required
        - `ramRequired` integer, required
        - `romRequired` integer, required
        - `arenaSize` integer, required
        - `modelSize` integer, required
      - `eon_ram_optimized` object
        - `ramRequired` integer, required
        - `romRequired` integer, required
        - `arenaSize` integer, required
        - `modelSize` integer, required
      - `customMetrics` KerasCustomMetric[]: Custom, device-specific performance metrics
        - `name` string, required: The name of the metric
        - `value` string, required: The value of this metric for this model type
      - `hasPerformance` boolean, required: If false, then no metrics are available for this target
      - `profilingError` string: Specific error during profiling (e.g. model not supported)
    - `predictions` ModelPrediction[]
      - `sampleId` integer, required
      - `startMs` number, required
      - `endMs` number, required
      - `label` string
      - `prediction` string, required
      - `predictionCorrect` boolean
      - `expectedAnomalyOutcome` string: Only set for anomaly detection projects. The expected anomaly outcome for this window — either “anomaly” or “no anomaly”. The outcome is determined by which labels are marked as anomalous in the project setup, or by the sample label if no such configuration is defined.
      - `f1Score` number: Only set for object detection projects
      - `anomalyScores` array[]: Only set for visual anomaly projects. 2D array of shape (n, n) with raw anomaly scores, where n varies based on the image input size and the specific visual anomaly algorithm used. The scores corresponds to each grid cell in the image's spatial matrix.
        - number[]
      - `boundingBoxes` BoundingBoxWithScore[]: Only set for object detection projects. Coordinates are scaled 0..1, not absolute values.
        - `label` string, required
        - `x` number, required
        - `y` number, required
        - `width` number, required
        - `height` number, required
        - `score` number, required
      - `labelMapPredictions` object: For samples with structured labels (in the form of a key/value label map), this object will contain per-key prediction info for the sample.
    - `visualization` 'featureExplorer' | 'dataExplorer' | 'none', required
    - `isSupportedOnMcu` boolean, required
    - `mcuSupportError` string
    - `profilingJobId` integer: If this is set, then we're still profiling this model. Subscribe to job updates to see when it's done (afterward the metadata will be updated).
    - `profilingJobFailed` boolean: If this is set, then the profiling job failed (get the status by getting the job logs for 'profilingJobId').
    - `additionalMetrics` AdditionalMetric[], required
      - `name` string, required
      - `value` string, required
      - `fullPrecisionValue` number, required
      - `tooltipText` string
      - `link` string
  - `hasTrainedModel` boolean
  - `thresholds` BlockThreshold[], required: List of configurable thresholds for this block.
    - `key` string, required: Identifier to reference the threshold. You'll need to refer to the threshold by this key when you set the threshold).
    - `description` string, required: User-friendly description of the threshold.
    - `helpText` string, required: Additional help text (shown in the UI under a "?" icon)
    - `suggestedValue` number: If the threshold has a suggested value, e.g. a max. absolute error for regression projects; or the min. anomaly score for visual anomaly detection, then this is the numeric value of that threshold.
    - `suggestedValueText` string: If the threshold has a suggested value, e.g. a max. absolute error for regression projects; or the min. anomaly score for visual anomaly detection, then this is the stringified value of that threshold.
    - `value` union, required: Current value of the threshold
      - number
      - string
    - `dropdownOptions` object[]: Optional list of options, will be shown in a dropdown.
      - `description` string, required: Full description of the value
      - `value` string, required: Value, maps back to "BlockThreshold#value"

---

[API](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api.md) - [All operations](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/llms.txt) - [OpenAPI document](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/revisions/e2a976d38427?raw)
