adelie.diagnostic.gradients#
- adelie.diagnostic.gradients(X: ndarray | MatrixNaiveBase32 | MatrixNaiveBase64, resids: ndarray, *, n_threads: int = 1)[source]#
Computes the gradients.
The gradient for the single-response is given by
\[\begin{align*} \hat{\gamma} = X^{\top} \hat{r} \end{align*}\]The gradient for the multi-response is given by
\[\begin{align*} \hat{\gamma} = (X\otimes I_K)^{\top} \mathrm{vec}(\hat{r}^\top) \end{align*}\]In both cases, \(\hat{r}\) is the residual as in
adelie.diagnostic.residuals()
.- Parameters:
- X(n, p) Union[ndarray, MatrixNaiveBase32, MatrixNaiveBase64]
Feature matrix. It is typically one of the matrices defined in
adelie.matrix
submodule ornumpy.ndarray
.- resids(L, n) or (L, n, K) ndarray
Residuals.
- n_threadsint, optional
Number of threads. Default is
1
.
- Returns:
- grads(L, p) or (L, p, K) ndarray
Gradients.
See also