Get optimized parameters from the output of run_nsga2R_cluster.
Source: R/parameter_optimization.R
get_optimized_parameters_nsga2r.Rdget_optimized_parameters_nsga2 will take as input the output of run_nsga2R_cluster and extract the optimal parameter values, either from the best solution at the end of the generations or the best solution across all generations.
Usage
get_optimized_parameters_nsga2(result_nsga2r, source_names, search_all_iterations = FALSE, top_n = NULL, summarise_weights = TRUE)Arguments
- result_nsga2r
The output of
run_nsga2R_cluster.- source_names
Character vector containing the names of the data sources.
- search_all_iterations
Logical indicating whether the best solution across all generations should be considered (TRUE) or only the best solution at the end of the generations (FALSE).
- top_n
If search_all_iterations=TRUE, this indicates how many of the best solutions should be considered.
- summarise_weights
If search_all_iterations=TRUE, a logical indicating whether the weights should be summarised by taking the mean and median.
Value
A list containing two dataframes, the optimal data source weights and the optimal hyperparameters.
Examples
if (FALSE) { # \dontrun{
results <- run_nsga2R_cluster(model_evaluation_optimization_nsga2r,
varNo = n_param, objDim = n_obj,
lowerBounds = lower_bounds, upperBounds = upper_bounds, popSize = 360, tourSize = 2, generations = 15, ncores = 8
)
# Get the best solution at the end of the generations
optimized_parameters <- get_optimized_parameters_nsga2(results, source_names, search_all_iterations = FALSE, top_n = NULL, summarise_weights = TRUE)
# Get the best solution across all generations, consider top 25 solutions and summarise weights
optimized_parameters <- get_optimized_parameters_nsga2(results, source_names, search_all_iterations = TRUE, top_n = 25, summarise_weights = TRUE)
} # }