Catching Problems Before They Become Crises
OCI Anomaly Detection is a managed machine learning service that identifies unusual patterns in time series data. For Oracle application developers, this means automatically detecting anomalies in transaction volumes, revenue patterns, system performance metrics, and any other time-stamped business data without building ML models from scratch.
How It Works
You train a model on historical normal data. The model learns the expected patterns, seasonality, and trends. When new data arrives, the model scores each data point as normal or anomalous, with a confidence score. You set sensitivity thresholds to control how aggressively anomalies are flagged.
Training a Model
# Prepare training data: CSV with timestamp and signal columns
timestamp,daily_orders,daily_revenue,avg_order_value
2024-01-01,150,45000,300
2024-01-02,160,48000,300
2024-01-03,145,43500,300
...
# Upload to Object Storage, then create the model via REST API
POST /20210101/aiPrivateEndpoints/{id}/models
{
"compartmentId": "ocid1.compartment...",
"modelTrainingDetails": {
"dataAssetIds": ["ocid1.dataasset..."],
"targetFap": 0.01
}
}
Detecting Anomalies in Real Time
-- From PL/SQL: submit recent data for anomaly scoring
DECLARE
l_payload CLOB;
l_response CLOB;
BEGIN
-- Build payload with recent data points
l_payload := build_anomaly_payload(p_lookback_days => 7);
l_response := APEX_WEB_SERVICE.MAKE_REST_REQUEST(
p_url => 'https://anomalydetection.aiservice.us-ashburn-1.oci.oraclecloud.com'
|| '/20210101/models/' || l_model_id || '/actions/detectAnomalies',
p_http_method => 'POST',
p_body => l_payload,
p_credential_static_id => 'OCI_AI_CRED'
);
-- Parse results and flag anomalies
process_anomaly_results(l_response);
END;
APEX Dashboard Integration
Build an APEX dashboard that overlays anomaly indicators on your existing business charts. Display normal data in the standard color and highlight anomalous data points in red. Add a drill-down that shows the anomaly details: which signal was anomalous, the expected range, and the actual value. Include a notification system that sends alerts when high-confidence anomalies are detected.
Use Cases
Monitor daily order volumes to detect unexpected drops that might indicate website issues or market shifts. Track payment processing times to catch performance degradation early. Watch inventory levels for unexpected consumption patterns. Monitor user login patterns to detect potential security breaches. Any time series data where “unusual” needs to be detected and acted upon is a candidate for anomaly detection.