Downloads · 30 days
0
maigurski/weatherAUS-max-temp-regression-MaiG
weatherAUS-max-temp-regression-MaiG is a machine learning model from maigurski. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Author: Mai Gurski Course: Data Science / Machine Learning – Assignment 2 Dataset: Weather in Australia (daily observations, ~145K rows)
Downloads · 30 days
0
Access
Public
Updated Dec 11, 2025
Repo size
14.9 MB
Likes
0
Public
Click a slice to open those files.
.csv14.1 MB · 69%
From the Hugging Face model README
Author: Mai Gurski
Course: Data Science / Machine Learning – Assignment 2
Dataset: Weather in Australia (daily observations, ~145K rows)
This notebook implements an end-to-end machine learning pipeline on the Weather in Australia dataset.
The goals are to:
MaxTemp).Copy of Assignment #2 – Classification, Regression, Clustering, Evaluation.ipynbThe dataset contains daily weather observations from multiple locations in Australia.
MinTemp, MaxTemp, Temp9am, Temp3pmHumidity9am, Humidity3pmWindSpeed9am, WindSpeed3pm, WindGustSpeed, WindDir9am, WindDir3pm, WindGustDirPressure9am, Pressure3pmRainToday, RainTomorrow, Location, DateIn this notebook I focus on:
MaxTemp_class (cool / medium / hot days).MaxTemp.Part 1 – Data Loading & Cleaning
Part 2 – Exploratory Data Analysis (EDA)
Part 3 – Baseline Models
Part 4 – Feature Engineering & Clustering
Part 5 – Regression with Engineered Features
Part 6 – Winning Regression Model
Part 7 – Regression-to-Classification
Part 8 – Train & Evaluate Classification Models
Part 9 – Presentation Video
In Part 2 I explored the Weather in Australia dataset to understand data quality, basic patterns and relationships before building any models.
Date column to a proper datetime type and kept only relevant columns.MaxTemp, RainTomorrow, MaxTemp_class) I dropped rows with a missing target."Unknown" category for missing values.Rainfall, MaxTemp, MinTemp, Humidity3pm and wind speed.Rainfall (values up to 371 mm).Rainfall at the 99th percentile (clipping very extreme days), without removing any rows:
mean, median, std, min, max, quartiles) for all numeric variables.MaxTemp.MaxTemp and:
MinTempTemp3pm and Temp9amRainTomorrow, which later guided feature engineering.To better understand the data, I used several visualizations:
Histograms and KDE plots for key numeric variables (temperatures, rainfall, humidity, pressure).
Box plots of MaxTemp by Location and by Season.
Scatter plots (e.g., Rainfall vs MaxTemp, Humidity3pm vs MaxTemp).

A correlation heatmap to summarize linear relationships.

PCA plots later used to visualize clusters (see Part 4).
These plots allowed me to identify skewed distributions, potential non-linear relationships and variables that are likely to be important for prediction.
Based on the EDA, I defined six research questions and answered each of them with specific plots and short written interpretations:
RQ1 – MaxTemp by location and season
How does the distribution of daily maximum temperature (MaxTemp) differ across locations and seasons in Australia?
→ Answered with box plots of MaxTemp by Location and by Season.

RQ2 – MaxTemp vs. rainfall
What is the relationship between daily rainfall and MaxTemp?
→ Answered with scatter plots and trend patterns showing how heavy rainfall days tend to be cooler.
RQ3 – Seasonality of temperature
How does MaxTemp vary across the four seasons (summer, autumn, winter, spring)?
→ Answered with seasonal box plots highlighting higher temperatures and larger variability in summer vs. winter.
RQ4 – Humidity and rain tomorrow
How are afternoon humidity levels (Humidity3pm) related to the likelihood of rain the next day (RainTomorrow)?

→ Answered with density/box plots comparing humidity distributions for RainTomorrow = Yes vs. No.
RQ5 – Intraday temperature dynamics
How do intraday temperature metrics (such as TempRange and TempChange_9am_3pm) relate to cloud cover, wind and other conditions?
→ Answered with scatter plots and correlation views using the engineered features.
RQ6 – Weather “types”
Can we discover meaningful weather “types” using clustering, and do they help explain variation in MaxTemp and humidity?
→ Answered by applying K-Means, visualizing clusters in PCA space and summarizing each cluster’s average profile (hot & dry, cool & humid, etc.).
These questions and visual answers bridge the gap between raw EDA and the modeling parts of the project: they directly motivated the engineered features, the clustering step, and the choice of models and metrics later on.
To improve model performance and capture domain structure, I engineered several new features:
Temperature-based features
TempRange = MaxTemp - MinTempTempChange_9am_3pm = Temp3pm - Temp9amHumidity & pressure changes
HumidityDiff_9am_3pm = Humidity3pm - Humidity9amPressureDiff_9am_3pm = Pressure3pm - Pressure9amSeasonality
Season (Winter / Spring / Summer / Autumn), derived from the date.Month_sin, Month_cos – cyclical encoding of the month to capture yearly periodicity.Clustering feature
weather_cluster – cluster ID (0–4) from K-Means on standardized weather variables.Classification targets
MaxTemp_bin / MaxTemp_class – 3-class label for daily maximum temperature, based on quantile thresholds (approximately 33% / 66%).These engineered features are used consistently across both regression and classification pipelines.
I applied K-Means on standardized weather features (MinTemp, Temp3pm, humidity, pressure, wind, etc.):
k = 5
Interpretation:
weather_cluster was added to the dataset and later turned out to be important for the models.Target: MaxTemp (continuous).
Training is done on the feature-engineered dataset using a consistent preprocessing pipeline:
Location, wind directions, RainToday, Season, etc.)| Model | MAE_test | RMSE_test | R²_test |
|---|---|---|---|
| LinearRegression + FE | ~0.88 | ~1.33 | ~0.96 |
| RandomForest + FE (subsample). | ~0.92 | ~1.37 | ~0.96 |
| GradientBoosting + FE (subsample). | ~0.71 | ~1.06 | ~0.97 |

MaxTemp.Using the Gradient Boosting model:
Temp3pm, Temp9am, TempRange, TempChange_9am_3pmweather_clusterLocation_Katherine)HumidityDiff_9am_3pm, Pressure3pm)
These results confirm that both raw temperature measurements and engineered daily-change features are crucial for predicting maximum temperature.
To create a discrete target for classification:
q1 (33%) ≈ 19.4°C, q2 (66%) ≈ 26.0°C.Class 0 – cool days (below q1)Class 1 – medium days (between q1 and q2)Class 2 – hot days (above q2)Class proportions are almost perfectly balanced:
Because the classes are balanced, accuracy is meaningful, but I still focus on macro F1 to give each class equal weight.
Using the same engineered features and preprocessing as in regression, I trained three classifiers for MaxTemp_class:
| Model | Accuracy | Macro Precision | Macro Recall | Macro F1 |
|---|---|---|---|---|
| LogisticRegression | ~0.925 | ~0.926 | ~0.926 | ~0.926 |
| RandomForest | ~0.935 | ~0.936 | ~0.935 | ~0.935 |
| GradientBoosting | ~0.938 | ~0.939 | ~0.939 | ~0.939 |
For each model I plot the confusion matrix on the test set.

Observations:
Winning regression model: Gradient Boosting Regressor with engineered features (Part 5).
models/best_regression_model_p6.pkl.Winning classification model: Gradient Boosting Classifier with engineered features (Part 8).
models/best_classification_model_p8.pkl.Both models can be loaded via pickle and used to predict MaxTemp (regression) or MaxTemp_class (classification) on new data with the same preprocessing steps.