Uses machine learning algorithms to forecast climate variables from simulated climate data.
forecasting_ml(
climate_data,
target = "Rainfall",
predictors = c("Tmin", "Tmax", "Avg.Temp", "RH", "WindSpeed", "Solar_Radiation", "ET0"),
forecast_horizon = 12,
start_forecast = NULL,
end_forecast = NULL,
method = c("rf", "lm", "gbm", "arima", "xgboost", "nnet", "all"),
frequency = c("month", "day", "year"),
train_fraction = 0.8,
include_lag = TRUE,
lag_period = 1,
ntree = 500,
hidden_nodes = 5,
digits = 2,
seed = 123
)Climate dataframe.
Variable to forecast.
Predictor variables.
Number of future periods.
Optional forecast start date. Must be coercible to Date.
Optional forecast end date. Must be coercible to Date.
If supplied, forecast_horizon is automatically calculated.
Forecasting method.
Forecast interval.
Options are:
"day",
"month",
"year".
Fraction of data for training.
Logical. Include lag predictor.
Lag size.
Number of trees for RF and GBM.
Number of hidden nodes for neural network.
Decimal places.
Random seed for reproducibility.
A list containing:
Forecasted future values.
RMSE, MAE, and correlation.
Variable importance table.
Trained ML model.
Returned only when method = "all".
Supported methods:
Random Forest ("rf")
Linear Regression ("lm")
Gradient Boosting ("gbm")
ARIMA Time-Series ("arima")
Extreme Gradient Boosting ("xgboost")
Neural Network ("nnet")
Run All Models ("all")