Scikit-Learn Helper
- class pyscipopt_ml.sklearn.skgetter.SKgetter(predictor, **kwargs)
Utility class for sklearn models convertors.
Implement some common functionalities: check predictor is fitted, get error
- predictor
Scikit-Learn predictor embedded into SCIP model.
- get_error(eps=None)
Returns error in SCIP’s solution with respect to the actual output of the trained predictor
- Parameters:
eps (float or int or None, optional) – The maximum allowed tolerance for a mismatch between the actual predictive model and SCIP. If the error is larger than eps an appropriate warning is printed
- Returns:
error – The absolute values of the difference between SCIP’s solution and the trained ML model’s output given the input as defined by SCIP. The matrix is the same dimension as the output of the trained predictor. Using sklearn / pyscipopt, the absolute difference between model.predict(input) and scip.getVal(output).
- Return type:
np.ndarray
- Raises:
NoSolution – If SCIP has no solution (either was not optimized or is infeasible).
- class pyscipopt_ml.sklearn.skgetter.SKtransformer(scip_model, transformer, input_vars, output_vars=None, unique_naming_prefix='', **kwargs)
Utility class for sklearn preprocessing models convertors.
Implement some common functionalities.
- transformer
Scikit-Learn transformer embedded into SCIP Model.
- get_error(eps=None)
Returns error in SCIP’s solution with respect to the actual output of the trained predictor
- Parameters:
eps (float or int or None, optional) – The maximum allowed tolerance for a mismatch between the actual predictive model and SCIP. If the error is larger than eps an appropriate warning is printed
- Returns:
error – The absolute values of the difference between SCIP’s solution and the trained ML model’s output given the input as defined by SCIP. The matrix is the same dimension as the output of the fitted transformer. Using sklearn / pyscipopt, the absolute difference between transformer.transform(input) and scip.getVal(output).
- Return type:
np.ndarray
- Raises:
NoSolution – If SCIP has no solution (either was not optimized or is infeasible).