adelie.adelie_core.state.StateGaussianPinNaive32#
- class adelie.adelie_core.state.StateGaussianPinNaive32#
Core state class for Gaussian, pin, naive method.
Methods
__init__
(*args, **kwargs)Overloaded function.
solve
(self)Solves the state-specific problem.
Attributes
Feature matrix.
List of indices that index a corresponding list of values for each active group.
Ordering such that
groups
is sorted in ascending order for the active groups.List of indices into
screen_set
that correspond to active groups.Number of active groups.
Percent deviance explained tolerance.
Elastic net parameter.
Benchmark time for performing coordinate-descent on the active set for each \(\lambda\).
Benchmark time for performing coordinate-descent on the screen set for each \(\lambda\).
betas[i]
is the solution atlmdas[i]
.Max constraint buffer size.
List of constraints for each group.
Difference in percent deviance explained tolerance.
List of group sizes corresponding to each element in
groups
.List of starting indices to each group where G is the number of groups.
True
if the function should fit with intercept.intercepts[i]
is the intercept atlmdas[i]
.Number of coordinate descents taken.
The regularization path to solve for.
lmdas[i]
is the regularization \(\lambda\) used for thei
th solution.Maximum number of active groups allowed.
Maximum number of coordinate descents.
Number of threads.
Maximum number of iterations for the BCD update.
Convergence tolerance for the BCD update.
Penalty factor for each group in the same order as
groups
.Residual \(y_c - X \beta\) where \(\beta\) is given by
screen_beta
.Weighted (by \(W\)) sum of
resid
.The change in unnormalized \(R^2\) given by \(\|y_c-X_c\beta_{\mathrm{old}}\|_{W}^2 - \|y_c-X_c\beta_{\mathrm{curr}}\|_{W}^2\).
rsqs[i]
is the unnormalized \(R^2\) atbetas[i]
.Column means of \(X\) for screen groups (weighted by \(W\)).
List of indices that index a corresponding list of values for each screen group.
Coefficient vector on the screen set.
Boolean vector that indicates whether each screen group in
groups
is active or not.List of indices into
groups
that correspond to the screen groups.List of \(V_k\) where \(V_k\) is from the SVD of \(\sqrt{W} X_{c,k}\) along the screen groups \(k\) and for possibly column-centered (weighted by \(W\)) \(X_k\).
List of \(D_k^2\) where \(D_k\) is from the SVD of \(\sqrt{W} X_{c,k}\) along the screen groups \(k\) and for possibly column-centered (weighted by \(W\)) \(X_k\).
Coordinate descent convergence tolerance.
Observation weights \(W\).
Mean of the response vector \(y\) (weighted by \(W\)), i.e. \(\mathbf{1}^\top W y\).
Variance of the response vector \(y\) (weighted by \(W\)), i.e. \(\|y_c\|_{W}^2\).
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: adelie.adelie_core.state.StateGaussianPinNaive32, X: adelie.adelie_core.matrix.MatrixNaiveBase32, y_mean: float, y_var: float, constraints: adelie.adelie_core.constraint.VectorConstraintBase32, groups: numpy.ndarray[numpy.int64[1, n]], group_sizes: numpy.ndarray[numpy.int64[1, n]], alpha: float, penalty: numpy.ndarray[numpy.float32[1, n]], weights: numpy.ndarray[numpy.float32[1, n]], screen_set: numpy.ndarray[numpy.int64[1, n]], screen_begins: numpy.ndarray[numpy.int64[1, n]], screen_vars: numpy.ndarray[numpy.float32[1, n]], screen_X_means: numpy.ndarray[numpy.float32[1, n]], screen_transforms: adelie.adelie_core.VectorMatrix32, lmda_path: numpy.ndarray[numpy.float32[1, n]], constraint_buffer_size: int, intercept: bool, max_active_size: int, max_iters: int, tol: float, adev_tol: float, ddev_tol: float, newton_tol: float, newton_max_iters: int, n_threads: int, rsq: float, resid: numpy.ndarray[numpy.float32[1, n], flags.writeable], resid_sum: float, screen_beta: numpy.ndarray[numpy.float32[1, n], flags.writeable], screen_is_active: numpy.ndarray[bool[1, n], flags.writeable], active_set_size: int, active_set: numpy.ndarray[numpy.int64[1, n], flags.writeable]) -> None
__init__(self: adelie.adelie_core.state.StateGaussianPinNaive32, arg0: adelie.adelie_core.state.StateGaussianPinNaive32) -> None
- solve(self: adelie.adelie_core.state.StateGaussianPinNaive32) dict #
Solves the state-specific problem.
- X#
Feature matrix.
- active_begins#
List of indices that index a corresponding list of values for each active group.
active_begins[i]
is the starting index corresponding to thei
th active group.
- active_order#
Ordering such that
groups
is sorted in ascending order for the active groups.groups[screen_set[active_set[active_order[i]]]]
is thei
th active group in ascending order.
- active_set#
List of indices into
screen_set
that correspond to active groups.screen_set[active_set[i]]
is thei
th active group. An active group is one with non-zero coefficient block, that is, for everyi
th active group,screen_beta[b:b+p] == 0
wherej = active_set[i]
,k = screen_set[j]
,b = screen_begins[j]
, andp = group_sizes[k]
.
- active_set_size#
Number of active groups.
active_set[i]
is only well-defined fori
in the range[0, active_set_size)
.
- adev_tol#
Percent deviance explained tolerance.
- alpha#
Elastic net parameter.
- benchmark_active#
Benchmark time for performing coordinate-descent on the active set for each \(\lambda\).
- benchmark_screen#
Benchmark time for performing coordinate-descent on the screen set for each \(\lambda\).
- betas#
betas[i]
is the solution atlmdas[i]
.
- constraint_buffer_size#
Max constraint buffer size. Equivalent to
np.max([0 if c is None else c.buffer_size() for c in constraints])
.
- constraints#
List of constraints for each group.
constraints[i]
is the constraint object corresponding to groupi
.
- ddev_tol#
Difference in percent deviance explained tolerance.
- group_sizes#
List of group sizes corresponding to each element in
groups
.group_sizes[i]
is the group size of thei
th group.
- groups#
List of starting indices to each group where G is the number of groups.
groups[i]
is the starting index of thei
th group.
- intercept#
True
if the function should fit with intercept.
- intercepts#
intercepts[i]
is the intercept atlmdas[i]
.
- iters#
Number of coordinate descents taken.
- lmda_path#
The regularization path to solve for.
- lmdas#
lmdas[i]
is the regularization \(\lambda\) used for thei
th solution.
- max_active_size#
Maximum number of active groups allowed.
- max_iters#
Maximum number of coordinate descents.
- n_threads#
Number of threads.
- newton_max_iters#
Maximum number of iterations for the BCD update.
- newton_tol#
Convergence tolerance for the BCD update.
- penalty#
Penalty factor for each group in the same order as
groups
.
- resid#
Residual \(y_c - X \beta\) where \(\beta\) is given by
screen_beta
.Note
This definition is unconventional. This was done deliberately as the algorithm is most efficient when it updates this quantity compared to the conventional quantity \(y_c-X_c \beta\).
- resid_sum#
Weighted (by \(W\)) sum of
resid
.
- rsq#
The change in unnormalized \(R^2\) given by \(\|y_c-X_c\beta_{\mathrm{old}}\|_{W}^2 - \|y_c-X_c\beta_{\mathrm{curr}}\|_{W}^2\).
- rsqs#
rsqs[i]
is the unnormalized \(R^2\) atbetas[i]
.
- screen_X_means#
Column means of \(X\) for screen groups (weighted by \(W\)).
- screen_begins#
List of indices that index a corresponding list of values for each screen group.
screen_begins[i]
is the starting index corresponding to thei
th screen group. From this index, readinggroup_sizes[screen_set[i]]
number of elements will grab values corresponding to the fulli
th screen group block.
- screen_beta#
Coefficient vector on the screen set.
screen_beta[b:b+p]
is the coefficient for thei
th screen group wherek = screen_set[i]
,b = screen_begins[i]
, andp = group_sizes[k]
.
- screen_is_active#
Boolean vector that indicates whether each screen group in
groups
is active or not.screen_is_active[i]
isTrue
if and only ifscreen_set[i]
is active.
- screen_set#
List of indices into
groups
that correspond to the screen groups.screen_set[i]
isi
th screen group.
- screen_transforms#
List of \(V_k\) where \(V_k\) is from the SVD of \(\sqrt{W} X_{c,k}\) along the screen groups \(k\) and for possibly column-centered (weighted by \(W\)) \(X_k\). It only needs to be properly initialized for groups with size > 1.
screen_transforms[i]
is \(V_k\) for thei
th screen group wherek = screen_set[i]
.
- screen_vars#
List of \(D_k^2\) where \(D_k\) is from the SVD of \(\sqrt{W} X_{c,k}\) along the screen groups \(k\) and for possibly column-centered (weighted by \(W\)) \(X_k\).
screen_vars[b:b+p]
is \(D_k^2\) for thei
th screen group wherek = screen_set[i]
,b = screen_begins[i]
, andp = group_sizes[k]
.
- tol#
Coordinate descent convergence tolerance.
- weights#
Observation weights \(W\).
- y_mean#
Mean of the response vector \(y\) (weighted by \(W\)), i.e. \(\mathbf{1}^\top W y\).
- y_var#
Variance of the response vector \(y\) (weighted by \(W\)), i.e. \(\|y_c\|_{W}^2\).