DataProblem

class desdeo_problem.problem.DataProblem(data, variable_names, objective_names, bounds=None, maximize=None, objectives=None, variables=None, constraints=None, nadir=None, ideal=None)[source]

Bases: MOProblem

A class for a data based problem.

A problem class for data-based problem. This supports surrogate modelling. Data should be given in the form of a pandas dataframe.

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.

  • bounds (pd.DataFrame, optional) – A pandas DataFrame containing the upper and lower bounds of the decision variables. Column names have to be same as variable_names. Row names have to be “lower_bound” and “upper_bound”.

  • 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

Methods Summary

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

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.