Chuyển đến nội dung
Skillpedia
Agent48k · #3879

azure-ai-anomalydetector-java

Skill này làm gì

Đoạn mã này giúp tìm các mẫu bất thường hoặc “anomaly” trong dữ liệu thay đổi theo thời gian, như doanh số hoặc số liệu cảm biến. Nó có thể phân tích một loại dữ liệu (đơn biến) hoặc nhiều loại dữ liệu liên quan (đa biến).

Khi nào nên dùng

  • ✓Khi bạn muốn biết doanh số hôm nay có khác biệt đáng kể so với bình thường không.
  • ✓Khi bạn theo dõi hiệu năng thiết bị để phát hiện sớm nguy cơ hỏng hóc.
  • ✓Khi bạn phân tích dữ liệu cảm biến để nhận ra các hành vi bất ngờ.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-ai-anomalydetector-java/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-ai-anomalydetector-java/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Phát hiện các bất thường trong dữ liệu nhiệt độ của 30 ngày qua.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn cung cấp dữ liệu lịch sử cho công cụ. Nó dùng thuật toán AI để học hành vi “bình thường” rồi đánh dấu những điểm dữ liệu lệch đáng kể khỏi mẫu đó.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Azure AI Anomaly Detector SDK for Java

Build anomaly detection applications using the Azure AI Anomaly Detector SDK for Java.

Installation

<dependency>
  <groupId>com.azure</groupId>
  <artifactId>azure-ai-anomalydetector</artifactId>
  <version>3.0.0-beta.6</version>
</dependency>

Client Creation

Sync and Async Clients

import 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();

With DefaultAzureCredential

import com.azure.identity.DefaultAzureCredentialBuilder;

MultivariateClient client = new AnomalyDetectorClientBuilder()
    .credential(new DefaultAzureCredentialBuilder().build())
    .endpoint(endpoint)
    .buildMultivariateClient();

Key Concepts

Univariate Anomaly Detection

  • Batch Detection: Analyze entire time series at once
  • Streaming Detection: Real-time detection on latest data point
  • Change Point Detection: Detect trend changes in time series

Multivariate Anomaly Detection

  • Detect anomalies across 300+ correlated signals
  • Uses Graph Attention Network for inter-correlations
  • Three-step process: Train → Inference → Results

Core Patterns

Univariate Batch Detection

import 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());
    }
}

Univariate Last Point Detection (Streaming)

UnivariateLastDetectionResult 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());
}

Change Point Detection

UnivariateChangePointDetectionOptions 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));
    }
}

Multivariate Model Training

import 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();

…
Câu hỏi thường gặp

Dữ liệu “đơn biến” và “đa biến” là gì?

Dữ liệu đơn biến là một chuỗi số theo thời gian (ví dụ chỉ nhiệt độ). Dữ liệu đa biến là nhiều chuỗi số có thể ảnh hưởng lẫn nhau (ví dụ nhiệt độ, áp suất và độ ẩm cùng lúc).

Tôi có cần nhiều dữ liệu để dùng công cụ này không?

Với phát hiện đơn biến, thường cần ít nhất 12 điểm dữ liệu. Với phát hiện đa biến, việc huấn luyện mô hình có thể cần tập dữ liệu lớn hơn.

Phát hiện “streaming” (thời gian thực) là gì?

Đó là khi công cụ phân tích dữ liệu mới nhất ngay khi nó đến, thay vì chờ một lô dữ liệu lớn.

Chi tiết

Mô tả gốc của tác giả

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.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#3879
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự