ExperimentalProblem

class desdeo_problem.problem.ExperimentalProblem(variable_names, objective_names, uncertainity_names, evaluators=None, dimensions_data=None, data=None, objective_functions=None, constraints=None)[source]

Bases: MOProblem

A problem class for data-based problem. This supports surrogate modelling. Data should be given in the form of a pandas dataframe. self.archive is created to save the true function evaluations and update the surrogate models if needed. self.archive updates whenever a true function evaluation happens.

Parameters:
  • data (pd.DataFrame) – The input data. This will be used for training the model.

  • variable_names (List[str]) – Names of the variables in the dataframe provided.

  • objective_names (List[str]) – Names of the objectices in the dataframe provided.

  • objectives (List[Union[ScalarDataObjective,VectorDataObjective,]], optional) – Objective instances, currently not supported. Defaults to None.

  • variables (List[Variable], optional) – Variable instances. Defaults to None. Currently not supported.

  • constraints (List[ScalarConstraint], optional) – Constraint instances. Defaults to None, which means that there are no constraints.

  • nadir (Optional[np.ndarray], optional) – Nadir of the problem. Defaults to None.

  • ideal (Optional[np.ndarray], optional) – Ideal of the problem. Defaults to None.

Raises:
  • ProblemError – When input data is not a dataframe.

  • ProblemError – When given objective or variable names are not in dataframe column

  • NotImplementedError – When objective instances are passed

  • NotImplementedError – When variable instances are passed

Note

not properly implemented!

Methods Summary

evaluate(decision_vectors, use_surrogate)

Evaluates the problem using an ensemble of input vectors.

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

Train surrogate models for all the objectives.

train_one_objective(name, model, ...[, ...])

Train one objective at a time, otherwise same is the train method.

Methods Documentation

evaluate(decision_vectors, use_surrogate)[source]

Evaluates the problem using an ensemble of input vectors.

Parameters:
  • decision_vectors (np.ndarray) – An 2D array of decision variable input vectors. Each column represent the values of each decision variable.

  • use_surrogate (bool) – A bool to control whether to use the true, potentially expensive function or a surrogate model to evaluate the objectives.

Returns:

If constraint are defined, returns the objective vector values and corresponding constraint values. Or, if no constraints are defined, returns just the objective vector values with None as the constraint values.

Return type:

Tuple[np.ndarray, Union[None, np.ndarray]]

Raises:
  • ProblemError – The decision_vectors have wrong dimensions.

  • ValueError – If decision_vectors violate the lower or upper bounds.

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

Train surrogate models for all the objectives.

The models should have a fit method and a predict method. The predict method should return predicted values as well as uncertainity value (even if they are none.)

Parameters:
  • models (Union[BaseRegressor, List[BaseRegressor]]) – The class for the surrogate modelling algorithm.

  • models_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) – The indices of the samples to be used for training the surrogate model. If no values are proveded, all samples are used.

  • data (pd.DataFrame, optional) – Use this argument if some external data is to be used for training. Defaults to None.

Raises:

ProblemError – If VectorDataObjective is used as one of the objective instances. They are not supported yet.

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

Train one objective at a time, otherwise same is the train method.

Parameters:
  • name (str) – Name of the objective to be trained.

  • model (BaseRegressor) – The class for the surrogate modelling algorithm.

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

  • index (List[int], optional) – The indices of the samples to be used for training the surrogate model. If no values are proveded, all samples are used.

  • data (pd.DataFrame, optional) – Use this argument if some external data is to be used for training. Defaults to None.

Raises:
  • ProblemError – If name is not in the list of objective names.

  • ProblemError – If VectorDataObjective is used as one of the objective instances. They are not supported yet.