Chapter 10 of The Nature of Code, Neural Networks, begins with the perceptron, a single-layer linear classifier trained by the perceptron learning rule. This applies it to measured weather.
I train the perceptron on a year of New York humidity and pressure with rain labels from the Open-Meteo archive, so the linear boundary has to face messy weather instead of a hand-drawn cloud of points.
Each day of 2025 for New York (Open-Meteo archive) is a point placed by mean relative humidity and mean sea-level pressure and labeled rain or no-rain by whether precipitation exceeded 0.5 mm. The perceptron adjusts three weights until its decision boundary separates the classes as well as a straight line can. The residual overlap is the chapter’s point: a single layer is limited to a linear boundary.
The perceptron computes \(\hat{y} = H(\mathbf{w} \cdot \mathbf{x} + b)\) with the Heaviside step \(H\), and trains by the update \(\mathbf{w} \leftarrow \mathbf{w} + \eta\,(y - \hat{y})\,\mathbf{x}\) for learning rate \(\eta\). Its decision boundary \(\mathbf{w} \cdot \mathbf{x} + b = 0\) is a hyperplane, here a line in the humidity-pressure plane. Rosenblatt’s convergence theorem guarantees termination only if the classes are linearly separable; rainy and dry days are not, so the boundary settles at minimum error rather than zero.
Data source: Open-Meteo Archive API
Endpoint:https://archive-api.open-meteo.com/v1/archive?latitude=40.71&longitude=-74.01&start_date=2025-01-01&end_date=2025-12-31&daily=precipitation_sum,relative_humidity_2m_mean,pressure_msl_mean
Access: Public, no key. Loaded from an hourly server-side refresh when possible, with a bundled snapshot fallback, and a live browser fetch only when the API allows CORS. Data window: Jan 1, 2025 - Dec 31, 2025 (pulled Aug 6, 2026 UTC)
All 365 days are listed below.