Meteo Predictor 🌦️
Modello di predizione giornaliera della pioggia basato su dati meteorologici storici.
Il modello utilizza un RandomForestClassifier insieme a preprocessing (imputer e one-hot encoder) per prevedere se il giorno successivo ci sarà pioggia significativa (>2mm) o nulla/minima (<2mm).
🛠️ Task
- Tipo di problema: classificazione binaria.
- Output:
"Presente"
(pioggia > 2mm) o"Nulla/Minima"
(pioggia ≤ 2mm). - Input: valori meteorologici giornalieri:
- Anno
- Mese
- Fase del mese (Inizio, Meta, Fine)
- Direzione vento massimo (es. N, SO)
- Temperatura minima, media e massima (°C)
- Umidità media e massima (%)
- Vento medio e massimo (km/h)
- Irradiamento solare (KJ/m²)
- Pressione (Pa)
- Pioggia odierna (mm)
⚡ Come usare il modello
Python
from huggingface_hub import hf_hub_download
import joblib
import pandas as pd
# Scarica il modello dal repo Hugging Face
model_path = hf_hub_download(repo_id="freyflyy/previsione-meteo-udine-modello", filename="model.pkl")
model_dict = joblib.load(model_path)
imputer = model_dict["modello_imputer"]
encoder = model_dict["modello_encoder"]
model = model_dict["modello_predittivo"]
# Esempio input
input_dict = {
"Anno": 2025,
"Mese": "Ago",
"PosizioneMese": "Meta",
"DirVentoMax": "SO",
"TempMin [°C]": 16.3,
"TempMed [°C]": 23.1,
"TempMax [°C]": 28.1,
"UmiditaMed [%]": 69,
"UmiditaMax [%]": 91,
"VentoMed [km/h]": 5,
"VentoMax [km/h]": 19,
"Radiazione [KJ/m2]": 25998,
"Pressione [Pa]": 100770,
"mmPioggia": 0
}
df_input = pd.DataFrame([input_dict])
# Preprocessing
numerical_cols = df_input.select_dtypes(include=[float, int]).columns.tolist()
categorical_cols = df_input.select_dtypes(include=["object"]).columns.tolist()
df_input[numerical_cols] = imputer.transform(df_input[numerical_cols])
encoded = encoder.transform(df_input[categorical_cols]).toarray()
encoded_df = pd.DataFrame(encoded, columns=encoder.get_feature_names_out(categorical_cols), index=df_input.index)
df_input_final = pd.concat([df_input.drop(columns=categorical_cols), encoded_df], axis=1)
# Predizione
pred = model.predict(df_input_final)[0]
print("Predizione pioggia:", pred)
📊 Accuratezza
Pioggia presente: ~71.5%
Nulla/minima: ~71.3%
🔗 Fonte dati
I dati meteorologici possono essere prelevati dal sito dell'Arpa FVG
📄 Licenza
MIT
- Downloads last month
- -