sparse_ho.criterion.CrossVal

class sparse_ho.criterion.CrossVal(criterion, cv=None)

Cross-validation loss.

Parameters
criterioninstance of BaseCriterion

A criterion that follows the sparse-ho API.

cvint, cross-validation generator or iterable, default=None

Determines the cross-validation splitting strategy. Possible inputs for cv are:

  • None, to use the default 5-fold cross-validation,

  • int, to specify the number of folds.

  • scikit-learn CV splitter

  • An iterable yielding (train, test) splits as arrays of indices.

For int/None inputs, KFold is used.

Attributes
dict_critsdict

The instances of criterion used for each fold.

__init__(criterion, cv=None)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(criterion[, cv])

Initialize self.

get_val(model, X, y, log_alpha[, monitor, tol])

Get value of criterion.

get_val_grad(model, X, y, log_alpha, …[, …])

Get value and gradient of criterion.

get_val_outer(*args, **kwargs)

Get value of outer criterion.

proj_hyperparam(model, X, y, log_alpha)

Project hyperparameter on a range of admissible values.