WeatherPrediction is a simple set of tools for predicting weather using machine learning.
It uses TensorFlow, pandas, joblib, NumPy, and scikit-learn.
By default, the project is configured to work with the Meteostat database.
Make sure you have the required packages installed:
pip install tensorflow pandas numpy scikit-learn joblib- Open
load_data.pyand set the filenames for the scalers:
joblib.dump(input_scaler, "../models/weather_model_4_input_scaler.pkl")
joblib.dump(target_scaler, "../models/weather_model_4_target_scaler.pkl")- Open
model_training.pyand set the training data path="../data/12375.csv"
_input, target, dates = get_data(path="../data/12375.csv", columns=columns,
time_star = "2018-05-21", time_stop = "2025-05-31", for_training=True)- Open
model_training.pyand set the model save path:
model.save("../models/weather_model_4.h5")- Set the number of training epochs and start training:
model.fit(_input, target, epochs=1000, validation_split=0.2)You can also modify the model structure, but remember to update the corresponding parts in load_data.py.
After training the model, you can make predictions by running main.py.
- Load the model and scalers:
model = load_model("models/weather_model_3.h5")
scaler_input = joblib.load("models/weather_model_3_input_scaler.pkl")
scaler_target = joblib.load("models/weather_model_3_target_scaler.pkl")- Load your input data (make sure the date range and format are correct and match
load_data.pysettings):
_input, target, dates = get_data(
path="data/Libertow Weather History.csv",
columns=columns,
time_star="2024-06-13",
time_stop="2025-06-10",
i_scaler=scaler_input,
t_scaler=scaler_target
)Ensure your data has at least 361 days (default requirement).
- Run
main.pyto get your weather predictions.
MIT