Pipeline Constraint

Module for formulating a sklearn.pipeline.Pipeline into a PySCIPOpt Model. The pipeline’s transformers (or preprocessing steps) can be any of the following: - sklearn.preprocessing.StandardScaler - sklearn.preprocessing.PolynomialFeatures - sklearn.preprocessing.Normalizer - sklearn.preprocessing.Binarizer

The final step of the pipeline must be a valid predictor.

pyscipopt_ml.sklearn.add_pipeline_constr(scip_model, pipeline, input_vars, output_vars=None, unique_naming_prefix='', **kwargs)

Formulate pipeline into scip_model.

The formulation predicts the values of output_vars using input_vars according to pipeline.

Parameters:
  • scip_model (SCIP Model) – The PySCIPOpt Model where the predictor should be inserted.

  • pipeline (sklearn.pipeline.Pipeline) – The pipeline to insert as predictor.

  • input_vars (list or np.ndarray) – Decision variables used as input for support vector in model.

  • output_vars (list or np.ndarray, optional) – Decision variables used as output for support vector in model.

  • unique_naming_prefix (str, optional) – A unique naming prefix that is used before all variable and constraint names. This parameter is important if the SCIP model is later printed to file and many predictors are added to the same SCIP model.

Returns:

Object containing information about what was added to scip_model to embed the predictor into it

Return type:

PipelineConstr

Raises:

NoModel – If the translation to SCIP of one of the elements in the pipeline is not implemented or recognized.

Notes

See add_predictor_constr for acceptable values for input_vars and output_vars

class pyscipopt_ml.sklearn.pipeline.PipelineConstr(scip_model, pipeline, input_vars, output_vars, unique_naming_prefix, **kwargs)

Class to formulate a trained sklearn.pipeline.Pipeline into a PySCIPOpt model.

Stores the changes to the SCIP Model for representing an instance into it. Inherits from AbstractPredictorConstr.

property input

Returns input variables of pipeline, i.e. input of its first step.

property input_values

Returns input values of pipeline in solution, i.e. input of its first step.

property output

Returns output variables of pipeline, i.e. output of its last step.

property output_values

Returns output values of pipeline in solution, i.e. output of its last step.