Skip to content

STPIS Anomaly Detection

The STPIS Anomaly Detection model identifies unusual reliability performance patterns in SAIDI, SAIFI, and MAIFI metrics. It uses an ensemble of Isolation Forest (unsupervised anomaly detection) and Z-score statistical testing to distinguish genuine performance outliers from normal variation across the 6-DNSP peer group.

The model serves two purposes:

  1. Data quality assurance: identifying reporting errors (impossible values, duplicated data)
  2. Performance monitoring: detecting genuine reliability degradation or unusually good performance that should be investigated

Isolation Forest isolates anomalies by randomly splitting the feature space:

from sklearn.ensemble import IsolationForest
from sklearn.preprocessing import StandardScaler
FEATURES = ['saidi_monthly', 'saifi_monthly', 'maifi_monthly',
'planned_pct', 'storm_events_count',
'peer_saidi_percentile', 'peer_saifi_percentile']
pipeline = Pipeline([
('scaler', StandardScaler()),
('iso_forest', IsolationForest(
contamination=0.05, # Assume 5% of observations are anomalous
n_estimators=200,
random_state=42
))
])

Isolation Forest produces an anomaly score (more negative = more anomalous). The threshold is calibrated on labelled historical data (known reporting errors and genuine events).

Z-scores are computed against the 6-DNSP peer group for each metric:

Z_SAIDI = (SAIDI_dnsp - Mean_SAIDI_peer_group) / StdDev_SAIDI_peer_group

Flags when |Z| > 2.5 standard deviations:

def z_score_anomaly(value, peer_values):
mean = np.mean(peer_values)
std = np.std(peer_values)
z = (value - mean) / std
return abs(z) > 2.5, z
def ensemble_decision(iso_score, z_score_flag):
"""
Flag as anomaly if BOTH methods agree (reduces false positives)
OR if Isolation Forest score is extreme (catches edge cases)
"""
iso_anomaly = iso_score < -0.3
if iso_anomaly and z_score_flag:
return "ANOMALY_HIGH_CONFIDENCE"
elif iso_anomaly and not z_score_flag:
return "ANOMALY_LOW_CONFIDENCE"
elif not iso_anomaly and z_score_flag:
return "STATISTICAL_OUTLIER"
else:
return "NORMAL"
MetricValue
Detection rate (True Positive Rate)93.4%
False positive rate4.7%
True negative rate95.3%
Precision89.1%
F191.2%
Z-score threshold2.5σ
Contamination parameter0.05

Evaluated on 2 years of labelled STPIS data (labelled by domain experts for known errors and genuine events).

The peer group used for Z-score benchmarking:

DNSPCustomersNetwork Length (km)Climate Zone
Ausgrid1.7M51,000Temperate/Summer
Endeavour Energy1.0M48,000Temperate/Summer
Essential Energy870K187,000Mixed/Rural
Energex1.4M52,000Subtropical
Ergon Energy730K155,000Mixed/Tropical
AusNet Services720K97,000Temperate
CategoryDescriptionTypical Cause
Reporting errorValue statistically impossibleData entry mistake, system error
Major storm eventSAIDI spike tracked to storm dataCyclone, bushfire, flood
Equipment failureHigh SAIDI from single feeder failureMajor fault on critical asset
Sustained degradationMulti-month SAIDI above targetDeferred maintenance catching up
OutperformanceSignificant improvement vs peer groupNetwork investment, new automation

When an anomaly is detected, the model estimates the revenue impact:

def estimate_revenue_impact(
saidi_delta_minutes: float,
customer_count: int,
incentive_rate_per_customer_minute: float
) -> float:
"""
Estimate STPIS revenue adjustment from SAIDI deviation.
"""
return saidi_delta_minutes * customer_count * incentive_rate_per_customer_minute

For a typical DNSP (1M customers), each minute of SAIDI deviation ≈ $100,000–$200,000 in STPIS revenue impact.

  • Live feed of detected anomalies with confidence level
  • Anomaly type classification (reporting error vs genuine event)
  • Revenue impact estimate
  • Recommended investigation actions

Peer Benchmarking (/dnsp/stpis/peer-benchmark)

Section titled “Peer Benchmarking (/dnsp/stpis/peer-benchmark)”
  • Scatter plot: all 6 DNSPs plotted by SAIDI vs SAIFI (current year)
  • Z-score distribution: shows where each DNSP sits relative to peer group
  • Historical trend: peer group performance over 5 years
Terminal window
# Latest anomaly detections
GET /api/dnsp/stpis/anomalies?dnsp=ausgrid&months=3
# Specific anomaly detail
GET /api/dnsp/stpis/anomalies/{anomaly_id}
# Peer group Z-scores
GET /api/dnsp/stpis/peer-scores?metric=saidi&year=2025
# Revenue impact estimate
GET /api/dnsp/stpis/revenue-impact?dnsp=ergon&saidi_actual=108&saidi_target=120