ScalarDataObjective

class desdeo_problem.problem.ScalarDataObjective(name, data, evaluator=None, lower_bound=-inf, upper_bound=inf, maximize=None)[source]

Bases: ScalarObjective

A simple Objective class for single valued objectives.

To be depreciated.

Use when the an evaluator/simulator returns a single objective value 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

Model of the data

Type:

BaseRegressor

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(model[, model_parameters, index, data])

Train surrogate model for the objective.

Methods Documentation

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

Train surrogate model for the objective.

Parameters:
  • model (BaseRegressor) – A regressor. The regressor, 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.

  • model_parameters (Dict) – **model_parameters is passed to the model when initialized.

  • 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 – For unexpected errors