01 Production-minded ML / Python

History meets
the forecast.
Then ML decides.

142 years of observations, seven local models and a second predictor built from 12 numerical weather systems, historical analogues and residual ML.

Data window
1884 — 2026
Train / holdout
80 / 20
Forecast modes
Local / Hybrid
forecast.out
VERIFIED / 2026-07-17

Next-day mean temperature

21.33°C
0.47°C below the last observation
02 JULOBSERVED → FORECAST17 JUL
MODELAdvanced weather gradient
TEST MAE1.78°C / 10,330 days
01 / OBSERVATIONS 52,062

daily records across the active archive

02 / MODELS 7

local candidates under one protocol

03 / TEST 10,330

future days held out from training

04 / API ENSEMBLE 12

numerical weather systems in hybrid mode

02 Observations / 1884—2026

One series.
Every signal.

Daily mean, min/max envelope and precipitation from the production CSV. Change the window and inspect any day.

weather_1884_2026.csv Latest observed window
15 JUN 2026 16.7°C min 13.7° / max 21.0° rain 0.0 mm
daily mean min — max range precipitation
FEATURE DICTIONARY / 21

Fields already produced by data.py

datetemp_avgtemp_mintemp_max wind_speedwind_speed_deviationprevious_temp_avg previous_temp_minprevious_temp_maxprevious_wind_speed previous_wind_speed_deviationtwo_days_ago_temp_avg three_day_temp_avgseven_day_temp_avgtemp_change season_sinseason_cosseason_sin_2 season_cos_2season_sin_3season_cos_3
MONTHLY CLIMATE Mean temperature · full archive
52,062 DAILY OBSERVATIONS

03 Evaluation / MAE

Seven models.
One honest split.

Every candidate faces the same chronological holdout. Lowest MAE on the final 20% wins.

MODEL COMPARISONMAE · focused scale 1.75—2.10°C
EARLY STOPPINGActual epochs / 100,000 limit
TIME SPLITChronological / no shuffle
TRAIN41,320 days1884-01-08 → 1998-04-04
TEST10,330 days1998-04-05 → 2026-07-16

No future observation enters training. Time order stays intact.

04 Hybrid forecast / live API

Twelve systems.
One correction layer.

Numerical forecasts set the baseline. Historical analogues add local context, then ridge ML learns the remaining error without touching the recent audit.

LIVE RUN / 18 JUL 2026Calendar forecast
HYBRID READY
19 JUL 2026 21.02°C

80% empirical interval20.20 — 21.83°C

HEURISTIC22.22° + API BASELINE21.08° + ML CORRECTION−0.066° = FORECAST21.02°
BACKTEST / MAE Validation vs untouched recent audit
LOWER IS BETTER / °C
validation recent audit Latest isolated run · 919 observed calibration days
01API ARCHIVEfrom 01 Jan 2024

Previous model runs are aligned with observed station temperatures.

02TRAINthrough 30 Sep 2024

The residual target is learned only from earlier dates.

03VALIDATION01 Oct 2024 — 30 Jun 2025

Alpha and residual share are selected here.

04RECENT AUDITfrom 01 Jul 2025

The final quality check never changes model settings.

05 Learned weights / local model

What moves
the forecast.

The compact six-feature model exposes an interpretable coefficient set. Right is positive, left is negative and zero remains visible.

WEATHER FEATURES GRADIENTCompact model · isolated verification run
bias +0.078

06 Architecture / two paths

Local when needed.
Hybrid when connected.

Both predictors start with the same long local history. One ends in a saved file; the other reaches calendar tomorrow through live forecasts.

01data.py

Load and engineer

pandas reads 142 years, fills wind gaps, then creates lags, rolling windows and three seasonal harmonics.

52,062 → 51,650
02preprocessing.py

Chronological split

The first 80% becomes train; the final 20% remains an untouched future holdout.

order preserved
03training.py

One evaluation run

Seven models train and score through the same orchestration layer.

7 candidates
04gradient_model.py

Advanced gradients

The 14-feature model uses NumPy matrix operations, a custom loss loop and early stopping.

vectorized
05api_weather_model.py

Build the API baseline

Twelve numerical systems are bias-corrected and weighted by recent observed error.

12 providers
06api_weather_model.py

Learn the residual

Historical analogues and 66 API-derived signals predict what the baseline still misses.

ridge ML
07reporting.py

Write an auditable result

Local mode saves a trace to forecast.txt; hybrid mode prints its interval and backtest.

two outputs
PATH / 01LOCAL ML
historical CSV7 modelstest MAEforecast.txt

Deterministic, offline and tied to the next date in the dataset.

PATH / 02HYBRID API + ML
local history+12 forecasts+heuristicresidual ML

Targets calendar tomorrow and falls back to local analogues if APIs fail.

07 Latest saved local forecast

One number.
Full trace.

This is the latest result persisted by main.py. It remains separate from the live hybrid run above.

Last observation
16 Jul 2026 / 21.8°C
Forecast
17 Jul 2026 / 21.41°C
Selected model
Advanced weather gradient
Current-code check
17 Jul 2026 / 21.33°C · isolated
forecast.txtsaved

01Next day forecast

02-----------------

03Model: Advanced weather gradient

04Last known date: 2026-07-16 00:00:00

05Forecast date: 2026-07-17

06Last temp avg: 21.8

07Predicted next temp avg: 21.41

08 Why the result is testable

Trust the test.
Not the headline.

This is a verifiable project snapshot, not a promise of permanent accuracy.

01

No future leakage

Lags and rolling means use past days only through shift(1).

02

Test follows train

No shuffling: evaluation reflects how the model performs later in time.

03

One common metric

MAE expresses all seven local approaches as the same average miss in degrees.

04

Audit stays untouched

Hybrid parameters are chosen on validation; recent audit only measures the result.

MODEL SELECTION MAE= 1n i=1n |ŷiyi|

Average model miss, measured in degrees

GRADIENT TRAINING MSE= 1n i=1n (ŷiyi)2

Loss function used during gradient training

RESIDUAL TARGET rt= yt bAPI,t

Ridge ML learns only what the adaptive API baseline still misses

09 Beta / next cycle

It works.
It isn't finished.

The current build now documents both real predictors. The next work is operational: repeatable outputs, tests and history.

DONE01

Working ML pipeline

Data → features → models → evaluation → forecast.

DONE02

Project web dossier

Metrics, charts, weights and architecture in one interface.

DONE03

Hybrid API model

12 forecasts + analogues + adaptive baseline + residual ridge.

NEXT04

Machine-readable runs

Persist local and hybrid metrics so the site can update automatically.

NEXT05

Forecast history

Compare every prediction with reality and track error over time.

NEXT06

Tests and caching

Cover the pipeline and cache historical API responses.