Functions
ML::Solver::Lars Namespace Reference

Functions

template<typename math_t , typename idx_t >
void larsFit (const raft::handle_t &handle, math_t *X, idx_t n_rows, idx_t n_cols, const math_t *y, math_t *beta, idx_t *active_idx, math_t *alphas, idx_t *n_active, math_t *Gram, int max_iter, math_t *coef_path, int verbosity, idx_t ld_X, idx_t ld_G, math_t eps)
 Train a regressor using LARS method. More...
 
template<typename math_t , typename idx_t >
void larsPredict (const raft::handle_t &handle, const math_t *X, idx_t n_rows, idx_t n_cols, idx_t ld_X, const math_t *beta, idx_t n_active, idx_t *active_idx, math_t intercept, math_t *preds)
 Predict with LARS regressor. More...
 

Function Documentation

◆ larsFit()

template<typename math_t , typename idx_t >
void ML::Solver::Lars::larsFit ( const raft::handle_t &  handle,
math_t *  X,
idx_t  n_rows,
idx_t  n_cols,
const math_t *  y,
math_t *  beta,
idx_t *  active_idx,
math_t *  alphas,
idx_t *  n_active,
math_t *  Gram,
int  max_iter,
math_t *  coef_path,
int  verbosity,
idx_t  ld_X,
idx_t  ld_G,
math_t  eps 
)

Train a regressor using LARS method.

Parameters
handleRAFT handle
Xdevice array of training vectors in column major format, size [n_rows * n_cols]. Note that the columns of X will be permuted if the Gram matrix is not specified. It is expected that X is normalized so that each column has zero mean and unit variance.
n_rowsnumber of training samples
n_colsnumber of feature columns
ydevice array of the regression targets, size [n_rows]. y should be normalized to have zero mean.
betadevice array of regression coefficients, has to be allocated on entry, size [max_iter]
active_idxdevice array containing the indices of active variables. Must be allocated on entry. Size [max_iter]
alphasthe maximum correlation along the regularization path are returned here. Must be a device array allocated on entry Size [max_iter].
n_activehost pointer to return the number of active elements, scalar.
Gramdevice array containing Gram matrix (X.T * X). Can be nullptr. Size [n_cols * ld_G]
max_itermaximum number of iterations, this equals with the maximum number of coefficients returned. max_iter <= n_cols.
coef_pathcoefficients along the regularization path are returned here. Must be nullptr, or a device array already allocated on entry. Size [max_iter * max_iter].
verbosityverbosity level
ld_Xleading dimension of X (stride of columns, ld_X >= n_rows).
ld_Gleading dimesion of G (ld_G >= n_cols)
epsnumeric parameter for Cholesky rank one update

◆ larsPredict()

template<typename math_t , typename idx_t >
void ML::Solver::Lars::larsPredict ( const raft::handle_t &  handle,
const math_t *  X,
idx_t  n_rows,
idx_t  n_cols,
idx_t  ld_X,
const math_t *  beta,
idx_t  n_active,
idx_t *  active_idx,
math_t  intercept,
math_t *  preds 
)

Predict with LARS regressor.

Parameters
handleRAFT handle
Xdevice array of training vectors in column major format, size [n_rows * n_cols].
n_rowsnumber of training samples
n_colsnumber of feature columns
ld_Xleading dimension of X (stride of columns)
betadevice array of regression coefficients, size [n_active]
n_activethe number of regression coefficients
active_idxdevice array containing the indices of active variables. Only these columns of X will be used for prediction, size [n_active].
intercept
predsdevice array to store the predictions, size [n_rows]. Must be allocated on entry.