Namespaces | |
Lars | |
Functions | |
void | sgdFit (raft::handle_t &handle, float *input, int n_rows, int n_cols, float *labels, float *coef, float *intercept, bool fit_intercept, int batch_size, int epochs, int lr_type, float eta0, float power_t, int loss, int penalty, float alpha, float l1_ratio, bool shuffle, float tol, int n_iter_no_change) |
void | sgdFit (raft::handle_t &handle, double *input, int n_rows, int n_cols, double *labels, double *coef, double *intercept, bool fit_intercept, int batch_size, int epochs, int lr_type, double eta0, double power_t, int loss, int penalty, double alpha, double l1_ratio, bool shuffle, double tol, int n_iter_no_change) |
void | sgdPredict (raft::handle_t &handle, const float *input, int n_rows, int n_cols, const float *coef, float intercept, float *preds, int loss) |
void | sgdPredict (raft::handle_t &handle, const double *input, int n_rows, int n_cols, const double *coef, double intercept, double *preds, int loss) |
void | sgdPredictBinaryClass (raft::handle_t &handle, const float *input, int n_rows, int n_cols, const float *coef, float intercept, float *preds, int loss) |
void | sgdPredictBinaryClass (raft::handle_t &handle, const double *input, int n_rows, int n_cols, const double *coef, double intercept, double *preds, int loss) |
void | cdFit (raft::handle_t &handle, float *input, int n_rows, int n_cols, float *labels, float *coef, float *intercept, bool fit_intercept, bool normalize, int epochs, int loss, float alpha, float l1_ratio, bool shuffle, float tol, float *sample_weight=nullptr) |
void | cdFit (raft::handle_t &handle, double *input, int n_rows, int n_cols, double *labels, double *coef, double *intercept, bool fit_intercept, bool normalize, int epochs, int loss, double alpha, double l1_ratio, bool shuffle, double tol, double *sample_weight=nullptr) |
void | cdPredict (raft::handle_t &handle, const float *input, int n_rows, int n_cols, const float *coef, float intercept, float *preds, int loss) |
void | cdPredict (raft::handle_t &handle, const double *input, int n_rows, int n_cols, const double *coef, double intercept, double *preds, int loss) |
template<typename math_t > | |
math_t | max (math_t a, math_t b) |
template<typename math_t > | |
math_t | invScaling (math_t eta, math_t power_t, int t) |
template<typename math_t > | |
math_t | regDLoss (math_t a, math_t b) |
template<typename math_t > | |
math_t | calOptimalInit (math_t alpha) |
template<typename math_t > | |
math_t | optimal (math_t alpha, math_t optimal_init, int t) |
template<typename math_t > | |
math_t | calLearningRate (ML::lr_type lr_type, math_t eta, math_t power_t, math_t alpha, math_t t) |
template<typename math_t > | |
void | initShuffle (std::vector< math_t > &rand_indices, std::mt19937 &g, math_t random_state=0) |
template<typename math_t > | |
void | shuffle (std::vector< math_t > &rand_indices, std::mt19937 &g) |
math_t ML::Solver::calLearningRate | ( | ML::lr_type | lr_type, |
math_t | eta, | ||
math_t | power_t, | ||
math_t | alpha, | ||
math_t | t | ||
) |
math_t ML::Solver::calOptimalInit | ( | math_t | alpha | ) |
void ML::Solver::cdFit | ( | raft::handle_t & | handle, |
double * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
double * | labels, | ||
double * | coef, | ||
double * | intercept, | ||
bool | fit_intercept, | ||
bool | normalize, | ||
int | epochs, | ||
int | loss, | ||
double | alpha, | ||
double | l1_ratio, | ||
bool | shuffle, | ||
double | tol, | ||
double * | sample_weight = nullptr |
||
) |
void ML::Solver::cdFit | ( | raft::handle_t & | handle, |
float * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
float * | labels, | ||
float * | coef, | ||
float * | intercept, | ||
bool | fit_intercept, | ||
bool | normalize, | ||
int | epochs, | ||
int | loss, | ||
float | alpha, | ||
float | l1_ratio, | ||
bool | shuffle, | ||
float | tol, | ||
float * | sample_weight = nullptr |
||
) |
Fits a linear, lasso, and elastic-net regression model using Coordinate Descent solver.
i.e. finds coefficients that minimize the following loss function:
f(coef) = 1/2 * || labels - input * coef ||^2
handle | Reference of raft::handle_t |
input | pointer to an array in column-major format (size of n_rows, n_cols) |
n_rows | n_samples or rows in input |
n_cols | n_features or columns in X |
labels | pointer to an array for labels (size of n_rows) |
coef | pointer to an array for coefficients (size of n_cols). This will be filled with coefficients once the function is executed. |
intercept | pointer to a scalar for intercept. This will be filled once the function is executed |
fit_intercept | boolean parameter to control if the intercept will be fitted or not |
normalize | boolean parameter to control if the data will be normalized or not; NB: the input is scaled by the column-wise biased sample standard deviation estimator. |
epochs | Maximum number of iterations that solver will run |
loss | enum to use different loss functions. Only linear regression loss functions is supported right now |
alpha | L1 parameter |
l1_ratio | ratio of alpha will be used for L1. (1 - l1_ratio) * alpha will be used for L2 |
shuffle | boolean parameter to control whether coordinates will be picked randomly or not |
tol | tolerance to stop the solver |
sample_weight | device pointer to sample weight vector of length n_rows (nullptr or uniform weights) This vector is modified during the computation |
void ML::Solver::cdPredict | ( | raft::handle_t & | handle, |
const double * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
const double * | coef, | ||
double | intercept, | ||
double * | preds, | ||
int | loss | ||
) |
void ML::Solver::cdPredict | ( | raft::handle_t & | handle, |
const float * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
const float * | coef, | ||
float | intercept, | ||
float * | preds, | ||
int | loss | ||
) |
void ML::Solver::initShuffle | ( | std::vector< math_t > & | rand_indices, |
std::mt19937 & | g, | ||
math_t | random_state = 0 |
||
) |
math_t ML::Solver::invScaling | ( | math_t | eta, |
math_t | power_t, | ||
int | t | ||
) |
math_t ML::Solver::max | ( | math_t | a, |
math_t | b | ||
) |
math_t ML::Solver::optimal | ( | math_t | alpha, |
math_t | optimal_init, | ||
int | t | ||
) |
math_t ML::Solver::regDLoss | ( | math_t | a, |
math_t | b | ||
) |
void ML::Solver::sgdFit | ( | raft::handle_t & | handle, |
double * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
double * | labels, | ||
double * | coef, | ||
double * | intercept, | ||
bool | fit_intercept, | ||
int | batch_size, | ||
int | epochs, | ||
int | lr_type, | ||
double | eta0, | ||
double | power_t, | ||
int | loss, | ||
int | penalty, | ||
double | alpha, | ||
double | l1_ratio, | ||
bool | shuffle, | ||
double | tol, | ||
int | n_iter_no_change | ||
) |
void ML::Solver::sgdFit | ( | raft::handle_t & | handle, |
float * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
float * | labels, | ||
float * | coef, | ||
float * | intercept, | ||
bool | fit_intercept, | ||
int | batch_size, | ||
int | epochs, | ||
int | lr_type, | ||
float | eta0, | ||
float | power_t, | ||
int | loss, | ||
int | penalty, | ||
float | alpha, | ||
float | l1_ratio, | ||
bool | shuffle, | ||
float | tol, | ||
int | n_iter_no_change | ||
) |
void ML::Solver::sgdPredict | ( | raft::handle_t & | handle, |
const double * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
const double * | coef, | ||
double | intercept, | ||
double * | preds, | ||
int | loss | ||
) |
void ML::Solver::sgdPredict | ( | raft::handle_t & | handle, |
const float * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
const float * | coef, | ||
float | intercept, | ||
float * | preds, | ||
int | loss | ||
) |
void ML::Solver::sgdPredictBinaryClass | ( | raft::handle_t & | handle, |
const double * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
const double * | coef, | ||
double | intercept, | ||
double * | preds, | ||
int | loss | ||
) |
void ML::Solver::sgdPredictBinaryClass | ( | raft::handle_t & | handle, |
const float * | input, | ||
int | n_rows, | ||
int | n_cols, | ||
const float * | coef, | ||
float | intercept, | ||
float * | preds, | ||
int | loss | ||
) |
void ML::Solver::shuffle | ( | std::vector< math_t > & | rand_indices, |
std::mt19937 & | g | ||
) |