Energy and utilities
Predict outages by meter or asset, and estimate next-period consumption.
Data mapping
- Entity
- meter or asset
- Group
- feeder or zone
- Profile
- generic; configure time windows with verticals.register
Supported analyses
- Will this meter record an outage within 30 days?
predict_event(target="outage", window_days=30)
Event Type contains reading and outage records. - What will the next reading be?
predict_value(target="reading", window_days=30)
Reference implementation
from datetime import datetime, timedelta
from vertiq import plugins, rules
from vertiq.mapping import Mapping, apply, repair
from vertiq.tasks import predict_event, predict_value
# rows: the source export as a list of dicts, e.g. list(csv.DictReader(open("export.csv")))
mapping = Mapping.parse({"entity": "Meter ID", "time": "Reading Date", "type": "Event Type", "value": "kWh", "group": "Feeder", "attrs": ["Tariff"], "date_format": "%Y-%m-%d"})
m, notes = repair(mapping, rows) # validates column names, value types and date format against the rows
ds, problems = apply(m, rows) # rows that fail to load are reported, not imputed
@plugins.feature("utility")
def recent_outages(entity, before, cut): # receives only events recorded before the cutoff
return {"outages_90": sum(1 for e in before if e.type == "outage"
and e.at >= cut - timedelta(days=90))}
task = predict_event(ds, target="outage", window_days=30, pack="utility")
print(task.status, task.report()) # "trained" only if the model outperformed the baseline on held-out entities
if task.status == "trained":
print(task.score("MTR-40211")) # probability with contributing factors
size = predict_value(ds, target="reading", window_days=30, pack="utility")
print(size.status, size.report())
flags = rules.run(ds, [
rules.repeat(7, type="outage"), # a second outage on the same meter within seven days
])
print(flags["summary"])
This code is executed by the test suite (tests/test_guides.py) against generated records with these column names.
Recommended plugin
recent_outages: Assets with recent outages are more likely to fail again.
Validation rules
rules.repeat(7, type="outage"): a second outage on the same meter within seven days
Implementation notes
- Aggregate high-frequency smart-meter data to daily readings before mapping.
Validation
- Energy tables, a domain excluded from Vertiq LM training
- Every deployment: the evaluation gate measures each model on the organisation's own held-out records before promotion.