pwtools.rbf.hyperopt.FitError.cv

FitError.cv(params)[source]

Cross validation fit errors.

Default is RepeatedKFold (if cv is a dict, else cv itself is used): Split data (points, values) randomly into K parts (“folds”, K = n_splits) along axis 0 and use each part once as test set, the rest as training set. For example ns=5: split in 5 parts at random indices, use 5 times 4/5 data for train, 1/5 for test (each of the folds), so 5 fits total -> 5 fit errors. Optionally repeat n_repeats times with different random splits. So, n_repeats * n_splits fit errors total.

Each time, build an Rbf model with self.rbf_kwds, fit, return the fit error (scalar sum of squares from Rbf.fit_error()).

Parameters:

params (seq length 1 or 2) –

params[0] = p
params[1] = r (optional)

Returns:

errs – direct fit errors on the test set from each split

Return type:

1d array