himalaya.ridge.solve_ridge_cv_svd¶
- himalaya.ridge.solve_ridge_cv_svd(X, Y, alphas=1.0, fit_intercept=False, score_func=<function l2_neg_loss>, cv=5, local_alpha=True, n_targets_batch=None, n_targets_batch_refit=None, n_alphas_batch=None, conservative=False, Y_in_cpu=False, warn=True)[source]¶
Solve ridge regression with a grid search over alphas.
- Parameters
- Xarray of shape (n_samples, n_features)
Input features.
- Yarray of shape (n_samples, n_targets)
Target data.
- alphasfloat or array of shape (n_alphas, )
Range of ridge regularization parameter.
- fit_interceptboolean
Whether to fit an intercept. If False, X and Y must be zero-mean over samples.
- score_funccallable
Function used to compute the score of predictions versus Y.
- cvint or scikit-learn splitter
Cross-validation splitter. If an int, KFold is used.
- local_alphabool
If True, alphas are selected per target, else shared over all targets.
- n_targets_batchint or None
Size of the batch for over targets during cross-validation. Used for memory reasons. If None, uses all n_targets at once.
- n_targets_batch_refitint or None
Size of the batch for over targets during refit. Used for memory reasons. If None, uses all n_targets at once.
- n_alphas_batchint or None
Size of the batch for over alphas. Used for memory reasons. If None, uses all n_alphas at once.
- conservativebool
If True, when selecting the hyperparameter alpha, take the largest one that is less than one standard deviation away from the best. If False, take the best.
- Y_in_cpubool
If True, keep the target values
Y
in CPU memory (slower).- warnbool
If True, warn if the number of samples is smaller than the number of features.
- Returns
- best_alphasarray of shape (n_targets, )
Selected best hyperparameter alphas.
- coefsarray of shape (n_samples, n_targets)
Ridge coefficients refit on the entire dataset, using selected best hyperparameters alpha. Always stored on CPU memory.
- cv_scoresarray of shape (n_targets, )
Cross-validation scores averaged over splits, for the best alpha.
- interceptarray of shape (n_targets,)
Intercept. Only returned when fit_intercept is True.