Projects
Electricity Usage & Alert Forecast

Smart-energy operations

Forecast usage. Anticipate demand alerts.

Translate daily weather and calendar conditions into two operational outputs: expected household electricity consumption and the probability of a critical high-demand day.

Weather+calendartocubic splinetodual forecast
coldmildhot
Usage outputkWh forecast
Risk outputalert probability
Training days250
Test days120
Inputs3
Alert prevalence32.4%

Data signal

Temperature carries the nonlinear story

Demand is lowest on mild days and rises at both temperature extremes. Humidity adds a smaller upward signal; weekend changes average usage but barely changes alert frequency.

Click a plot to enlarge
Temperature
Humidity
Weekend
Temperature
Humidity
Weekend
TemperatureClear U-shape

Linear correlation understates the effect because cold and heat push demand in opposite directions.

HumiditySecondary upward pressure

Consumption and alert frequency generally rise in more humid conditions.

WeekendUsage effect, little alert separation

Alert rate is 32% on weekdays and 33% on weekends.

Mean usage36.05 kWh
Usage range17.79-78.15
Mean humidity54.03%
Weekend share34%

Model design

One spline basis, two operational models

A hand-built cubic B-spline lets temperature bend smoothly while humidity and weekend remain transparent additive effects.

Usage model

OLS on a cubic B-spline basis

usage = sum betajBj(temperature) + betaHhumidity + betaWweekend

2 internal knotsmanual least squaresCV MSE 20.4297
Alert model

Logistic probability on the same basis

P(alert) = sigmoid(sum betajBj(temperature) + betaHhumidity + betaWweekend)

0 internal knotsthreshold 0.5log loss 0.4608
01Clamp the domain

Boundary knots stay fixed at the physical sensor range: 0 and 40 C.

02Construct from scratch

Cox-de Boor recursion produces the cubic basis without a spline library.

03Avoid collinearity

No separate intercept: the spline basis already sums to one.

04Return two outputs

Continuous kWh usage and calibrated-looking alert probabilities.

Daily usage forecast

Reserve around a U-shaped load curve

At average humidity on a weekday, expected consumption bottoms out near mild temperatures and climbs sharply toward both cold and hot extremes.

Fitted consumption curveaverage humidity, weekday
20304050+010203040 C
Validation error20.4297mean squared error
Test forecast mean37.146 kWhacross 120 hidden days
Operational interpretationExtremes require reservemild days create the lowest expected load

High-demand probability

Alerts concentrate at temperature extremes

The probability curve gives operators a graded warning signal. A 0.5 threshold turns it into a reviewable alert while retaining probability for prioritization.

Fitted high-demand probabilityaverage humidity, weekday
0.00.51.0010203040 C
Probability quality0.4608log loss; Brier 0.1440
Mean test probability0.403model-implied daily risk
Flagged test days51 / 12042.5% at threshold 0.5

Model analytics

Fit, tuning and stability support the policy

Data relationships stay on the Data slide. This page focuses only on model evidence and the boundary between simple correlations and nonlinear prediction.

Click a plot to enlarge
Usage fit
Alert fit
Usage tuning
Alert tuning
Usage stability
Alert stability
Correlation heatmap for project variables
Selected flexibility2 knots for usage, 0 for alerts

The tasks share a cubic basis but keep separate complexity choices.

Curve stabilityThe U-shape persists

Bootstrap fits retain low mild-weather demand and high exposure at both extremes.

Correlation boundaryLinear summaries miss the mechanism

Temperature correlation is weak for alert status because opposite extremes cancel.

Operational recommendation

Plan reserves with usage; escalate with probability

The two outputs belong in one daily planning workflow, but they answer different questions and should not be collapsed into a single score.

Capacity planning

Consumption spline

Forecast mean37.15
UnitkWh
CV MSE20.43

Use the continuous forecast as the expected load and add a business-defined reserve buffer.

Operational alerting

Logistic spline

Mean risk0.403
Flag rate42.5%
Threshold0.50

Use probability to rank urgency; use the threshold only when a binary alert is operationally required.

01Ingest

Temperature, humidity, and weekend indicator.

02Forecast

Generate expected kWh and high-demand probability.

03Reserve

Set base capacity from the continuous usage estimate.

04Escalate

Prioritize high-risk days and extreme conditions.