syne_tune.optimizer.schedulers.searchers.bayesopt.models.cost.sklearn_cost_model module
- class syne_tune.optimizer.schedulers.searchers.bayesopt.models.cost.sklearn_cost_model.ScikitLearnCostModel(model_type=None)[source]
Bases:
NonLinearCostModelDeterministic cost model, where
c0(x) = b0(constant), andc1(x)is given by ascikit.learn(orscipy) regression model. Parameters areb0and those of the regression model.- Parameters:
model_type (
Optional[str]) – Regression model forc1(x)
- transform_dataset(dataset, num_data0, res_min)[source]
Transforms dataset (see
_data_for_c1_regression()) into a dataset representation (dict), which is used askwargsinfit_regressor().- Parameters:
dataset (
List[Tuple[Dict[str,Union[str,float,int]],float]])num_data0 (
int)res_min (
int)
- Return type:
Dict[str,Any]- Returns:
Used as kwargs in fit_regressor
- static fit_regressor(b0, **kwargs)[source]
Given value for
b0, fits regressor to dataset specified via kwargs (seetransform_dataset()). Returns the criterion function value forb0as well as the fitted regression model.- Parameters:
b0 (
float)kwargs
- Returns:
fval, model
- class syne_tune.optimizer.schedulers.searchers.bayesopt.models.cost.sklearn_cost_model.UnivariateSplineCostModel(scalar_attribute, input_range, spline_degree=3)[source]
Bases:
NonLinearCostModelHere,
c1(x)is given by a univariate spline (UnivariateSpline), where a single scalar is extracted from x.In the second part of the dataset (
pos >= num_data0), duplicate entries with the same config in dataset are grouped into one, using the mean as target value, and a weight equal to the number of duplicates. This still leaves duplicates in the overall dataset, one in data0, the other indata1, but spline smoothing can deal with this.- transform_dataset(dataset, num_data0, res_min)[source]
Transforms dataset (see
_data_for_c1_regression()) into a dataset representation (dict), which is used askwargsinfit_regressor().- Parameters:
dataset (
List[Tuple[Dict[str,Union[str,float,int]],float]])num_data0 (
int)res_min (
int)
- Return type:
Dict[str,Any]- Returns:
Used as kwargs in fit_regressor
- static fit_regressor(b0, **kwargs)[source]
Given value for
b0, fits regressor to dataset specified via kwargs (seetransform_dataset()). Returns the criterion function value forb0as well as the fitted regression model.- Parameters:
b0 (
float)kwargs
- Returns:
fval, model