run_nsga2R_cluster: Run NSGA-II for parameter optimization.

run_nsga2R_clusterR Documentation

Run NSGA-II for parameter optimization.

Description

run_nsga2R_cluster runs the NSGA-II algorithm for parameter optimization and allows for parallelization. The core of this function is adapted from nsga2R::nsga2R.

Usage

run_nsga2R_cluster(run_id, fn, varNo, objDim, lowerBounds = rep(-Inf, varNo), upperBounds = rep(Inf, varNo), popSize = 100, tourSize = 2, generations = 20, cprob = 0.7, XoverDistIdx = 5, mprob = 0.2, MuDistIdx = 10, ncores = 24)

Arguments

fn

The function to be optimized, usually model_evaluation_optimization_nsga2.

varNo

The number of variables to be optimized, usually the number of data sources + 4 hyperparameters (lr_sig_hub, gr_hub, ltf_cutoff, damping_factor).

objDim

Number of objective functions

lowerBounds

A numeric vector containing the lower bounds for the variables to be optimized (default: -Inf)

upperBounds

A numeric vector containing the upper bounds for the variables to be optimized (default: Inf)

popSize

The population size (default: 100)

tourSize

The tournament size (default: 2)

generations

The number of generations (default: 20)

ncores

The number of cores to be used for parallelization (default: 24)

cprob

The crossover probability (default: 0.7)

XoverDistIdx

The crossover distribution index, it can be any nonnegative real number (default: 5)

mprob

The mutation probability (default: 0.2)

MuDistIdx

The mutation distribution index, it can be any nonnegative real number (default: 10)

...

Additional arguments to fn.

Value

An 'nsga2R' object containing input settings and the following elements:

  • intermed_output_list_params: a list with intermediate values of parameters for each generation (each element has dimensions popSize x varNo)

  • intermed_output_list_obj: a list with intermediate values of objective functions for each generation (each element has dimensions popSize x objDim)

  • parameters: the solutions of variables that were optimized

  • objectives: non-dominated objective function values

  • paretoFrontRank: nondomination ranks (or levels) that each non-dominated solution belongs to

  • crowdingDistance: crowding distances of each non-dominated solution

Examples

## Not run: 
source_names <- c(lr_network$source, sig_network$source, gr_network$source) %>% unique()
n_param <- length(source_names) + 4
n_obj <- 4
lower_bounds <- c(rep(0,times = length(source_names)), 0, 0, 0.9, 0.01)
upper_bounds <- c(rep(1,times = length(source_names)), 1, 1, 0.999, 0.99)
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)

## End(Not run)


saeyslab/nichenetr documentation built on Sept. 7, 2024, 10:27 a.m.