Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Build anomaly detection applications with Azure AI Anomaly Detector SDK for Java. Use when implementing univariate/multivariate anomaly detection, time-series analysis, or AI-powered monitoring.
.claude/skills/azure-ai-anomalydetector-java/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-19 | ✗→✓ | ▲ Improved | — | — |
| case-16 | ✗→✓ | ▲ Improved | — | — |
| case-05 | ✗→✓ | ▲ Improved | — | — |
| case-07 | ✗→✓ | ▲ Improved | — | — |
| case-18 | ✗→✓ | ▲ Improved | — | — |
Build anomaly detection applications using the Azure AI Anomaly Detector SDK for Java.
xml<dependency> <groupId>com.azure</groupId> <artifactId>azure-ai-anomalydetector</artifactId> <version>3.0.0-beta.6</version> </dependency>
javaimport com.azure.ai.anomalydetector.AnomalyDetectorClientBuilder; import com.azure.ai.anomalydetector.MultivariateClient; import com.azure.ai.anomalydetector.UnivariateClient; import com.azure.core.credential.AzureKeyCredential; String endpoint = System.getenv("AZURE_ANOMALY_DETECTOR_ENDPOINT"); String key = System.getenv("AZURE_ANOMALY_DETECTOR_API_KEY"); // Multivariate client for multiple correlated signals MultivariateClient multivariateClient = new AnomalyDetectorClientBuilder() .credential(new AzureKeyCredential(key)) .endpoint(endpoint) .buildMultivariateClient(); // Univariate client for single variable analysis UnivariateClient univariateClient = new AnomalyDetectorClientBuilder() .credential(new AzureKeyCredential(key)) .endpoint(endpoint) .buildUnivariateClient();
javaimport com.azure.identity.DefaultAzureCredentialBuilder; MultivariateClient client = new AnomalyDetectorClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .endpoint(endpoint) .buildMultivariateClient();
javaimport com.azure.ai.anomalydetector.models.*; import java.time.OffsetDateTime; import java.util.List; List<TimeSeriesPoint> series = List.of( new TimeSeriesPoint(OffsetDateTime.parse("2023-01-01T00:00:00Z"), 1.0), new TimeSeriesPoint(OffsetDateTime.parse("2023-01-02T00:00:00Z"), 2.5), // ... more data points (minimum 12 points required) ); UnivariateDetectionOptions options = new UnivariateDetectionOptions(series) .setGranularity(TimeGranularity.DAILY) .setSensitivity(95); UnivariateEntireDetectionResult result = univariateClient.detectUnivariateEntireSeries(options); // Check for anomalies for (int i = 0; i < result.getIsAnomaly().size(); i++) { if (result.getIsAnomaly().get(i)) { System.out.printf("Anomaly detected at index %d with value %.2f%n", i, series.get(i).getValue()); } }
javaUnivariateLastDetectionResult lastResult = univariateClient.detectUnivariateLastPoint(options); if (lastResult.isAnomaly()) { System.out.println("Latest point is an anomaly!"); System.out.printf("Expected: %.2f, Upper: %.2f, Lower: %.2f%n", lastResult.getExpectedValue(), lastResult.getUpperMargin(), lastResult.getLowerMargin()); }
javaUnivariateChangePointDetectionOptions changeOptions = new UnivariateChangePointDetectionOptions(series, TimeGranularity.DAILY); UnivariateChangePointDetectionResult changeResult = univariateClient.detectUnivariateChangePoint(changeOptions); for (int i = 0; i < changeResult.getIsChangePoint().size(); i++) { if (changeResult.getIsChangePoint().get(i)) { System.out.printf("Change point at index %d with confidence %.2f%n", i, changeResult.getConfidenceScores().get(i)); } }
javaimport com.azure.ai.anomalydetector.models.*; import com.azure.core.util.polling.SyncPoller; // Prepare training request with blob storage data ModelInfo modelInfo = new ModelInfo() .setDataSource("https://storage.blob.core.windows.net/container/data.zip?sasToken") .setStartTime(OffsetDateTime.parse("2023-01-01T00:00:00Z")) .setEndTime(OffsetDateTime.parse("2023-06-01T00:00:00Z")) .setSlidingWindow(200) .setDisplayName("MyMultivariateModel"); // Train model (long-running operation) AnomalyDetectionModel trainedModel = multivariateClient.trainMultivariateModel(modelInfo); String modelId = trainedModel.getModelId(); System.out.println("Model ID: " + modelId); // Check training status AnomalyDetectionModel model = multivariateClient.getMultivariateModel(modelId); System.out.println("Status: " + model.getModelInfo().getStatus());
javaMultivariateBatchDetectionOptions detectionOptions = new MultivariateBatchDetectionOptions() .setDataSource("https://storage.blob.core.windows.net/container/inference-data.zip?sasToken") .setStartTime(OffsetDateTime.parse("2023-07-01T00:00:00Z")) .setEndTime(OffsetDateTime.parse("2023-07-31T00:00:00Z")) .setTopContributorCount(10); MultivariateDetectionResult detectionResult = multivariateClient.detectMultivariateBatchAnomaly(modelId, detectionOptions); String resultId = detectionResult.getResultId(); // Poll for results MultivariateDetectionResult result = multivariateClient.getBatchDetectionResult(resultId); for (AnomalyState state : result.getResults()) { if (state.getValue().isAnomaly()) { System.out.printf("Anomaly at %s, severity: %.2f%n", state.getTimestamp(), state.getValue().getSeverity()); } }
javaMultivariateLastDetectionOptions lastOptions = new MultivariateLastDetectionOptions() .setVariables(List.of( new VariableValues("variable1", List.of("timestamp1"), List.of(1.0f)), new VariableValues("variable2", List.of("timestamp1"), List.of(2.5f)) )) .setTopContributorCount(5); MultivariateLastDetectionResult lastResult = multivariateClient.detectMultivariateLastAnomaly(modelId, lastOptions); if (lastResult.getValue().isAnomaly()) { System.out.println("Anomaly detected!"); // Check contributing variables for (AnomalyContributor contributor : lastResult.getValue().getInterpretation()) { System.out.printf("Variable: %s, Contribution: %.2f%n", contributor.getVariable(), contributor.getContributionScore()); } }
java// List all models PagedIterable<AnomalyDetectionModel> models = multivariateClient.listMultivariateModels(); for (AnomalyDetectionModel m : models) { System.out.printf("Model: %s, Status: %s%n", m.getModelId(), m.getModelInfo().getStatus()); } // Delete a model multivariateClient.deleteMultivariateModel(modelId);
javaimport com.azure.core.exception.HttpResponseException; try { univariateClient.detectUnivariateEntireSeries(options); } catch (HttpResponseException e) { System.out.println("Status code: " + e.getResponse().getStatusCode()); System.out.println("Error: " + e.getMessage()); }
bashAZURE_ANOMALY_DETECTOR_ENDPOINT=https://<resource>.cognitiveservices.azure.com/ AZURE_ANOMALY_DETECTOR_API_KEY=<your-api-key>
TimeGranularity to your actual data frequencyHttpResponseException for API errorsThis skill is applicable to execute the workflow or actions described in the overview.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 22 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +43 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.