VectorDataObjective

class desdeo_problem.problem.VectorDataObjective(name, data, evaluator=None, lower_bounds=None, upper_bounds=None, maximize=None)[source]

Bases: VectorObjective

A Objective class for multi/valued objectives.

Use when the an evaluator/simulator returns a multiple objective values or when there is no evaluator/simulator.

X

Dataframe with corresponds the points where the objective value is known.

Type:

pd.DataFrame

y

The objective values corresponding the points.

Type:

pd.Series

variable_names

The names of the variables in X

Type:

pd.Index

_model

BaseRegressor (or None if not trained) models for each objective, keys are the names of objectives.

Type:

Dict

_model_trained

boolean if model is trained for each objective, keys are the names of objectives. Default false.

Type:

Dict

Parameters:
  • name (List[str]) – The name of the objective. Should be the same as a column name in the data.

  • data (pd.DataFrame) – The data in a pandas dataframe. The columns should be named after variables/objective.

  • evaluator (Union[None, Callable], optional) – A python function that contains the analytical function or calls the simulator to get the true objective value. By default None, as this is not required.

  • lower_bound (float, optional) – Lower bound of the objective, by default -np.inf

  • upper_bound (float, optional) – Upper bound of the objective, by default np.inf

  • maximize (List[bool], optional) – Boolean describing whether the objective is to be maximized or not, by default None, which defaults to [False], hence minimizes.

Raises:

ObjectiveError – When the name provided during initialization does not match any name in the columns of the data provided during initilizaiton.

Methods Summary

train(models[, model_parameters, index, data])

Train surrogate models for the objective.

Methods Documentation

train(models, model_parameters=None, index=None, data=None)[source]

Train surrogate models for the objective.

Parameters:
  • model (BaseRegressor or List[BaseRegressors]) – A regressor or a list of regressors. The regressor/s, when initialized, should have a fit method and a predict method. The predict method should return the predicted objective value, as well as the uncertainity value, in a tuple. If the regressor does not support calculating uncertainity, return a tuple of objective value and None. If a single regressor is provided, that regressor is used for all the objectives. If a list of regressors is provided, and if the list contains one regressor for each objective, then those individual regressors are used to model the objectives. If the number of regressors is not equal to the number of objectives, an error is raised.

  • model_parameters (Dict or List[Dict]) – The parameters for the regressors. Should be a dict if a single regressor is provided. If a list of regressors is provided, the parameters should be in a list of dicts, same length as the list of regressors(= number of objs).

  • index (List[int], optional) – Indices of the samples (in self.X and self.y), to be used to train the surrogate model. By default None, which trains the model on the entire dataset. This behaviour may be changed in the future to support test-train split or cross validation.

  • data (pd.DataFrame, optional) – Extra data to be used for training only. This data is not saved. By default None, which then uses self.X and self.y for training.

Raises:
  • ObjectiveError – If the formats of the model and model parameters do not match

  • ObjectiveError – If the lengths of list of models and/or model parameter dictionaries are not equal to the number of objectives.