Logo

Related Topics

  • Documentation overview
    • API
      • Previous: himalaya.ridge.solve_group_ridge_random_search
      • Next: himalaya.progress_bar.ProgressBar

Navigation

  • Getting started
  • Model descriptions
  • Model flowchart
  • Troubleshooting
  • Gallery of examples
  • API
  • Changelog

Quick search

himalaya.ridge.solve_banded_ridge_random_search¶

himalaya.ridge.solve_banded_ridge_random_search(Xs, Y, n_iter=100, concentration=[0.1, 1.0], alphas=1.0, fit_intercept=False, score_func=<function l2_neg_loss>, cv=5, return_weights=False, local_alpha=True, jitter_alphas=False, random_state=None, n_targets_batch=None, n_targets_batch_refit=None, n_alphas_batch=None, progress_bar=True, conservative=False, Y_in_cpu=False, diagonalize_method='svd', warn=True)¶

Solve group ridge regression using random search on the simplex.

Solve the group-regularized ridge regression:

b* = argmin_b ||Z @ b - Y||^2 + ||b||^2

where the feature space X_i is scaled by a group scaling

Z_i = exp(deltas[i] / 2) X_i
Parameters
Xslist of len (n_spaces), with arrays of shape (n_samples, n_features)

Input features.

Yarray of shape (n_samples, n_targets)

Target data.

n_iterint, or array of shape (n_iter, n_spaces)

Number of feature-space weights combination to search. If an array is given, the solver uses it as the list of weights to try, instead of sampling from a Dirichlet distribution.

concentrationfloat, or list of float

Concentration parameters of the Dirichlet distribution. If a list, iteratively cycle through the list. Not used if n_iter is an array.

alphasfloat or array of shape (n_alphas, )

Range of ridge regularization parameter. The log group-weights deltas are equal to log(gamma/alpha), where gamma is randomly sampled on the simplex, and alpha is selected from a list of candidates.

fit_interceptboolean

Whether to fit an intercept. If False, Xs 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.

return_weightsbool

Whether to refit on the entire dataset and return the weights.

local_alphabool

If True, alphas are selected per target, else shared over all targets.

jitter_alphasbool

If True, alphas range is slightly jittered for each gamma.

random_stateint, or None

Random generator seed. Use an int for deterministic search.

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.

progress_barbool

If True, display a progress bar over gammas.

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).

diagonalize_methodstr in {“svd”}

Method used to diagonalize the features.

warnbool

If True, warn if the number of samples is smaller than the number of features.

Returns
deltasarray of shape (n_spaces, n_targets)

Best log feature-space weights for each target.

refit_weightsarray of shape (n_features, n_targets), or None

Refit regression weights on the entire dataset, using selected best hyperparameters. Refit weights are always stored on CPU memory.

cv_scoresarray of shape (n_iter, n_targets)

Cross-validation scores per iteration, averaged over splits, for the best alpha. Cross-validation scores will always be on CPU memory.

interceptarray of shape (n_targets,)

Intercept. Only returned when fit_intercept is True.

©2020, Gallant lab. | Powered by Sphinx 4.1.2 & Alabaster 0.7.12 | Page source