desdeo_emo.surrogatemodels
This module provides implementations of EAs which can be used for training surrogate models.
Submodules
Package Contents
Classes
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
The base class for the problems. |
- class desdeo_emo.surrogatemodels.BioGP(training_algorithm: Type[desdeo_emo.EAs.BaseEA.BaseEA] = PPGA, pop_size: int = 500, probability_crossover: float = 0.9, probability_mutation: float = 0.3, max_depth: int = 5, max_subtrees: int = 4, prob_terminal: float = 0.5, complexity_scalar: float = 0.5, error_lim: float = 0.001, init_method: str = 'ramped_half_and_half', model_selection_criterion: str = 'min_error', loss_function: str = 'mse', single_obj_generations: int = 10, function_set=('add', 'sub', 'mul', 'div'), terminal_set=None)
Bases:
desdeo_problem.surrogatemodels.SurrogateModels.BaseRegressor
Helper class that provides a standard way to create an ABC using inheritance.
- fit(X: pandas.DataFrame, y: pandas.DataFrame)
- _create_individuals()
- _model_performance(trees: LinearNode, X: numpy.ndarray = None, y: numpy.ndarray = None)
- predict(X: numpy.ndarray)
- select()
- static add(x, y)
- static sub(x, y)
- static mul(x, y)
- static div(x, y)
- static sqrt(x)
- static log(x)
- static sin(x)
- static cos(x)
- static tan(x)
- static neg(x)
- class desdeo_emo.surrogatemodels.EvoNN(num_hidden_nodes: int = 20, p_omit: float = 0.2, w_low: float = -5.0, w_high: float = 5.0, activation_function: str = 'sigmoid', loss_function: str = 'mse', training_algorithm: Type[desdeo_emo.EAs.BaseEA.BaseEA] = PPGA, pop_size: int = 500, model_selection_criterion: str = 'akaike_corrected', recombination_type: str = 'evonn_xover_mutation', crossover_type: str = 'standard', mutation_type: str = 'gaussian')[source]
Bases:
desdeo_problem.surrogatemodels.SurrogateModels.BaseRegressor
Helper class that provides a standard way to create an ABC using inheritance.
- fit(X: numpy.ndarray, y: numpy.ndarray)
- _model_performance(first_layer: numpy.ndarray = None, X: numpy.ndarray = None, y_true: numpy.ndarray = None)
- predict(X: numpy.ndarray = None, first_layer: numpy.ndarray = None, training: bool = False)
- activate(x)
- calculate_linear(previous_layer_output)
Calculate the final layer using LLSQ or
- Parameters:
non_linear_layer (np.ndarray) – Output of the activation function
- Returns:
linear_layer (np.ndarray) – The optimized weight matrix of the upper part of the network
predicted_values (np.ndarray) – The prediction of the model
training_error (float) – The model’s training error
- _create_individuals()
- select()
- class desdeo_emo.surrogatemodels.EvoDN2(num_subnets: int = 4, num_subsets: int = 4, max_layers: int = 4, max_nodes: int = 4, p_omit: float = 0.2, w_low: float = -5.0, w_high: float = 5.0, subsets: list = None, activation_function: str = 'sigmoid', loss_function: str = 'mse', training_algorithm: desdeo_emo.EAs.BaseEA.BaseEA = PPGA, pop_size: int = 500, model_selection_criterion: str = 'min_error', verbose: int = 0)[source]
Bases:
desdeo_problem.surrogatemodels.SurrogateModels.BaseRegressor
Helper class that provides a standard way to create an ABC using inheritance.
- fit(X: numpy.ndarray, y: numpy.ndarray)
- _model_performance(individuals: numpy.ndarray = None, X: numpy.ndarray = None, y_true: numpy.ndarray = None)
- _feed_forward(subnets, X)
- _calculate_linear(previous_layer_output)
Calculate the final layer using LLSQ or
- Parameters:
non_linear_layer (np.ndarray) – Output of the activation function
- Returns:
linear_layer (np.ndarray) – The optimized weight matrix of the upper part of the network
predicted_values (np.ndarray) – The prediction of the model
- activate(x)
- predict(X)
- select()
- _create_individuals()
- class desdeo_emo.surrogatemodels.surrogateProblem(performance_evaluator)[source]
Bases:
desdeo_problem.problem.ProblemBase
The base class for the problems.
All other problem classes should be derived from this.
- nadir
Nadir values for the problem, initiated = None
- Type:
np.ndarray
- ideal
Ideal values for the problem, initiated = None
- Type:
np.ndarray
- nadir_fitness
Fitness values for nadir, initiated = None
- Type:
np.ndarray
- ideal_fitness
Fitness values for ideal, initiated = None
- Type:
np.ndarray
- __n_of_objectives
Number of objectives, initiated = 0
- Type:
int
- __n_of_variables
Number of variables, initiated = 0
- Type:
int
- __decision_vectors
Array of decision variable vectors, initiated = None
- Type:
np.ndarray
- __objective_vectors
Array of objective variable vectors, initiated = None
- Type:
np.ndarray
- evaluate(model_parameters, use_surrogates=False)
Abstract method to evaluate problem.
Evaluates the problem using an ensemble of input vectors. Uses surrogate models if available. Otherwise, it uses the true evaluator.
- Parameters:
decision_vectors (np.ndarray) – An array of decision variable
vectors. (input) –
use_surrogate (bool) – A bool to control whether to use the true, potentially
objectives. (expensive function or a surrogate model to evaluate the) –
- Returns:
- Dict with the following keys:
- ’objectives’ (np.ndarray): The objective function values for each input
vector.
- ’constraints’ (Union[np.ndarray, None]): The constraint values of the
problem corresponding each input vector.
- ’fitness’ (np.ndarray): Equal to objective values if objective is to be
minimized. Multiplied by (-1) if objective to be maximized.
- ’uncertainity’ (Union[np.ndarray, None]): The uncertainity in the
objective values.
- Return type:
(Dict)
- evaluate_constraint_values()
Abstract method to evaluate constraint values.
Evaluate just the constraint function values using the attributes decision_vectors and objective_vectors
Note
Currently not supported by ScalarMOProblem
- get_variable_bounds()
Abstract method to get variable bounds
- get_objective_names()