View source: R/counterfactual_model.R
run_fnn | R Documentation |
Trains a feedforward neural network (FNN) model on the specified training dataset and makes predictions on the test dataset in a counterfactual scenario. The model uses meteorological variables and sin/cosine-transformed features. Scales the data before training and rescales predictions, as the model does not converge with unscaled data.
run_fnn(train, test, params, calc_shaps)
train |
A data frame or tibble containing the training dataset,
including the target variable ( |
test |
A data frame or tibble containing the test dataset on which predictions will be made, using the same meteorological variables as in the training dataset. |
params |
A list of parameters that define the following:
|
calc_shaps |
Boolean value. If TRUE, calculate SHAP values for the
method used and format them so they can be visualised with
|
This function provides flexibility for users with their own data pipelines
or workflows. For a simplified pipeline, consider using
run_counterfactual()
.
Experiment with hyperparameters such as learning_rate
,
batchsize
, hidden_layers
, and num_epochs
to improve
performance.
Warning: Using many or large hidden layers in combination with a high number of epochs can lead to long training times.
A list with three elements:
dt_predictions
A data frame containing the test data along with the predicted values:
prediction
The predicted values from the FNN model.
prediction_lower
The same predicted values, as no quantile model is available yet for FNN.
prediction_upper
The same predicted values, as no quantile model is available yet for FNN.
model
The trained FNN model object from the
deepnet::nn.train()
function.
importance
SHAP importance values (if
calc_shaps = TRUE
). Otherwise, NULL
.
data(mock_env_data)
params <- load_params()
res <- run_fnn(
train = mock_env_data[1:80, ],
test = mock_env_data[81:100, ], params,
calc_shaps = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.