adelie.diagnostic.predict#
- adelie.diagnostic.predict(X: ndarray | MatrixNaiveBase32 | MatrixNaiveBase64, betas: ndarray | csr_matrix, intercepts: ndarray, *, offsets: ndarray | None = None, n_threads: int = 1)[source]#
Computes the linear predictions.
The single-response linear prediction is given by
The multi-response linear prediction is given by
The single or multi-response is detected based on the shape of
intercepts
. Ifintercepts
one-dimensional, we assume single-response. Otherwise, we assume multi-response.- Parameters:
- X(n, p) Union[ndarray, MatrixNaiveBase32, MatrixNaiveBase64]
Feature matrix. It is typically one of the matrices defined in
adelie.matrix
submodule ornumpy.ndarray
.- betas(L, p) or (L, p*K) Union[ndarray, csr_matrix]
Coefficient vectors
.- intercepts(L,) or (L, K) ndarray
Intercepts
.- offsets(n,) or (n, K) ndarray, optional
Observation offsets
. Default isNone
, in which case, it is set tonp.zeros(n)
ify
is single-response andnp.zeros((n, K))
if multi-response.- n_threadsint, optional
Number of threads. Default is
1
.
- Returns:
- linear_preds(L, n) or (L, n, K) ndarray
Linear predictions.