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:
NonLinearCostModel
Deterministic cost model, where
c0(x) = b0
(constant), andc1(x)
is given by ascikit.learn
(orscipy
) regression model. Parameters areb0
and 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 askwargs
infit_regressor()
.- Parameters:
dataset (
List
[Tuple
[Dict
[str
,Union
[int
,float
,str
]],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 forb0
as 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:
NonLinearCostModel
Here,
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 askwargs
infit_regressor()
.- Parameters:
dataset (
List
[Tuple
[Dict
[str
,Union
[int
,float
,str
]],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 forb0
as well as the fitted regression model.- Parameters:
b0 (
float
) –kwargs –
- Returns:
fval, model