pwtools.rbf.hyperopt.FitError

class pwtools.rbf.hyperopt.FitError(points, values, rbf_kwds={}, cv={'n_repeats': 1, 'n_splits': 5}, cv_kwds=None)[source]

Bases: object

Direct or cross-validation (CV) fit error of Rbf for a parameter set [p,r] or just [p] for r constant.

All methods accept a sequence params with either only p (length 1) or p and r (length 2) to build a Rbf model and fit it.

examples:

r != None -> normal linear solver
params = [1.5, 0] -> no regularization (r=0)
params = [1.5, 1e-8] -> with regularization
r = None -> linear least squares solver (only for testing, not
recommended for production)
params = [1.5]
params = [1.5, None]

Use err_cv() or err_direct() as error metric for param. Or use __call__() which will call one or the other, depending on params.

__init__(points, values, rbf_kwds={}, cv={'n_repeats': 1, 'n_splits': 5}, cv_kwds=None)[source]
Parameters:
  • points (see Rbf)

  • values (see Rbf)

  • rbf_kwds (dict) – for Rbf(points, values, **rbf_kwds)

  • cv ({dict, sklearn.model_selection.BaseCrossValidator instance) – or anything with that API, None}, optional, if dict then cross-validation parameters for sklearn.model_selection.RepeatedKFold, if BaseCrossValidator-like class then this is used to split data, if None then __call__() will use err_direct(), else err_cv()

  • cv_kwds (deprecated: dict of kwds for default RepeatedKFold)

__call__(params)[source]

Call self as a function.

Methods

cv(params)

Cross validation fit errors.

err_cv(params)

Mean of cv().

err_direct(params)

Normal fit error w/o CV.