w_MLP / README.md
Go4444Ward's picture
Add coordinate weather MLP base weights
2b6ba7f
|
Raw History Blame Contribute Delete
3.24 kB
metadata
license: mit
library_name: pytorch
pipeline_tag: tabular-regression
tags:
  - weather
  - time-series
  - mlp
  - korea

Coordinate Weather MLP

A coordinate- and time-conditioned MLP that maps hourly weather forecast values to nine weather variables. The model is pretrained on Korean weather data from 2015 to 2022 and is intended as a base model for fine-tuning.

Files

File Description
weather_initial.pt state_dict of CoordinateMLP (float32, about 261 MiB, 68.3M parameters)
weather_settings.json Input feature names, input scaling (x_center, x_scale), output names
weather_model.py CoordinateMLP definition

Load the weights with weights_only=True:

import torch
from weather_model import CoordinateMLP

state = torch.load("weather_initial.pt", map_location="cpu", weights_only=True)
model = CoordinateMLP(state["center"].tolist(), state["scale"].tolist())
model.load_state_dict(state)
model.eval()

Architecture

  • Input: 27 raw columns, expanded inside the model to 283 features (24 raw columns, 2 normalized coordinates, 1 scaled time value, 128 spatial Fourier features, 128 temporal Fourier features).
  • Linear(283, 4096) with SiLU, then 4 residual blocks h = (h + SiLU(Linear(4096, 4096)(h))) / sqrt(2), then Linear(4096, 9).
  • forward returns normalized_output * scale + center, so outputs are in physical units. center and scale are stored as buffers in the checkpoint.

Input (27 columns)

Column Content
0-9 The 10 forecast features, scaled as (x - x_center) / x_scale; missing values are set to 0
10-19 Availability flags for the 10 features (1 if the value is present, 0 if missing)
20-21 sin, cos of hour of day: 2π · hour / 24 (Asia/Seoul local time)
22-23 sin, cos of day of year: 2π · day_of_year / 365.25 (Asia/Seoul local time)
24-25 Latitude, longitude (degrees)
26 Elapsed time in hours (time feature)

Forecast features, in the order used by x_center and x_scale (weather_settings.json → forecast_features):

cloud_cover, air_temp, air_temp_high, air_temp_low, rel_humidity, surface_pressure, wind_spd, wind_bearing, rainfall, snowfall

Output (9 values)

Names are in weather_settings.json → output_names, in this order. Values are in the units of the source observations.

Name Description Valid range
air_temp Air temperature -60 to 65
rel_humidity Relative humidity 0 to 100
wind_spd Wind speed 0 to 60
surface_pressure Station-level air pressure 850 to 1100
cloud_cover_tenths Cloud amount on a 0-10 scale 0 to 10
sunshine Hourly sunshine 0 to 1
solar_radiation Solar radiation 0 to 6
solar_radiation_2 Solar radiation at the second-best matching station 0 to 6
solar_radiation_3 Solar radiation at the third-best matching station 0 to 6

The model itself does not clip its outputs; clip them to the valid ranges if needed.

Intended use

Base model for fine-tuning on weather data from the same kind of source. Predictions outside the 2015-2022 period are extrapolations.