liba 0.1.15
An algorithm library based on C/C++
|
Data Structures | |
struct | a_regress_linear |
instance structure for linear regression More... | |
Typedefs | |
typedef struct a_regress_linear | a_regress_linear |
Functions | |
void | a_regress_linear_init (a_regress_linear *ctx, double *coef_p, size_t coef_n, double bias) |
initialize for linear regression | |
double | a_regress_linear_eval (a_regress_linear const *ctx, double const *val) |
calculate predicted value for linear regression | |
void | a_regress_linear_err1 (a_regress_linear const *ctx, size_t n, double const *x, double const *y, double *err) |
calculate residuals for linear regression | |
void | a_regress_linear_err2 (a_regress_linear const *ctx, size_t n, double const *const *x, double const *y, double *err) |
calculate residuals for linear regression | |
void | a_regress_linear_pdm1 (a_regress_linear const *ctx, size_t n, double const *x, double *pdm, double y_mean) |
calculate prediction deviation from mean for linear regression | |
void | a_regress_linear_pdm2 (a_regress_linear const *ctx, size_t n, double const *const *x, double *pdm, double y_mean) |
calculate prediction deviation from mean for linear regression | |
void | a_regress_linear_gd (a_regress_linear *ctx, double const *input, double error, double alpha) |
gradient descent for linear regression | |
void | a_regress_linear_sgd (a_regress_linear *ctx, double const *x, double y, double alpha) |
stochastic gradient descent for linear regression | |
void | a_regress_linear_sgd1 (a_regress_linear *ctx, size_t n, double const *x, double const *y, double alpha) |
stochastic gradient descent for linear regression | |
void | a_regress_linear_sgd2 (a_regress_linear *ctx, size_t n, double const *const *x, double const *y, double alpha) |
stochastic gradient descent for linear regression | |
void | a_regress_linear_bgd1 (a_regress_linear *ctx, size_t n, double const *x, double const *err, double alpha) |
batch gradient descent for linear regression | |
void | a_regress_linear_bgd2 (a_regress_linear *ctx, size_t n, double const *const *x, double const *err, double alpha) |
batch gradient descent for linear regression | |
double | a_regress_linear_mgd1 (a_regress_linear *ctx, size_t n, double const *x, double const *y, double *err, double delta, double lrmax, double lrmin, size_t lrtim, size_t epoch, size_t batch) |
mini-batch gradient descent for linear regression | |
double | a_regress_linear_mgd2 (a_regress_linear *ctx, size_t n, double const *const *x, double const *y, double *err, double delta, double lrmax, double lrmin, size_t lrtim, size_t epoch, size_t batch) |
mini-batch gradient descent for linear regression | |
void | a_regress_linear_zero (a_regress_linear *ctx) |
zeroing for linear regression | |
void a_regress_linear_bgd1 | ( | a_regress_linear * | ctx, |
size_t | n, | ||
double const * | x, | ||
double const * | err, | ||
double | alpha ) |
batch gradient descent for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n*coef_n], err[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in] | err | residuals, specified as a numeric vector |
[in] | alpha | learning rate for gradient descent |
void a_regress_linear_bgd2 | ( | a_regress_linear * | ctx, |
size_t | n, | ||
double const *const * | x, | ||
double const * | err, | ||
double | alpha ) |
batch gradient descent for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n][coef_n], err[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in] | err | residuals, specified as a numeric vector |
[in] | alpha | learning rate for gradient descent |
void a_regress_linear_err1 | ( | a_regress_linear const * | ctx, |
size_t | n, | ||
double const * | x, | ||
double const * | y, | ||
double * | err ) |
calculate residuals for linear regression
[in] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n*coef_n], y[n], err[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in] | y | response data, specified as a numeric vector |
[in,out] | err | residuals, specified as a numeric vector |
void a_regress_linear_err2 | ( | a_regress_linear const * | ctx, |
size_t | n, | ||
double const *const * | x, | ||
double const * | y, | ||
double * | err ) |
calculate residuals for linear regression
[in] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n][coef_n], y[n], err[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in] | y | response data, specified as a numeric vector |
[in,out] | err | residuals, specified as a numeric vector |
double a_regress_linear_eval | ( | a_regress_linear const * | ctx, |
double const * | val ) |
calculate predicted value for linear regression
[in] | ctx | points to an instance of linear regression |
[in] | val | independent variables |
void a_regress_linear_gd | ( | a_regress_linear * | ctx, |
double const * | input, | ||
double | error, | ||
double | alpha ) |
gradient descent for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | input | predictor data, specified as a numeric vector |
[in] | error | residual, specified as a numeric scalar |
[in] | alpha | learning rate for gradient descent |
void a_regress_linear_init | ( | a_regress_linear * | ctx, |
double * | coef_p, | ||
size_t | coef_n, | ||
double | bias ) |
initialize for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | coef_p | points to regression coefficients |
[in] | coef_n | number of regression coefficients |
[in] | bias | intercept |
double a_regress_linear_mgd1 | ( | a_regress_linear * | ctx, |
size_t | n, | ||
double const * | x, | ||
double const * | y, | ||
double * | err, | ||
double | delta, | ||
double | lrmax, | ||
double | lrmin, | ||
size_t | lrtim, | ||
size_t | epoch, | ||
size_t | batch ) |
mini-batch gradient descent for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n*coef_n], y[n], err[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in] | y | response data, specified as a numeric vector |
[in,out] | err | residuals, specified as a numeric vector |
[in] | delta | threshold for gradient descent value |
[in] | lrmin | minimum learning rate of iterations |
[in] | lrmax | maximum learning rate of iterations |
[in] | lrtim | total number of learning rate steps |
[in] | epoch | maximum number of epochs |
[in] | batch | batch size of data |
double a_regress_linear_mgd2 | ( | a_regress_linear * | ctx, |
size_t | n, | ||
double const *const * | x, | ||
double const * | y, | ||
double * | err, | ||
double | delta, | ||
double | lrmax, | ||
double | lrmin, | ||
size_t | lrtim, | ||
size_t | epoch, | ||
size_t | batch ) |
mini-batch gradient descent for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n][coef_n], y[n], err[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in] | y | response data, specified as a numeric vector |
[in,out] | err | residuals, specified as a numeric vector |
[in] | delta | threshold for gradient descent value |
[in] | lrmin | minimum learning rate of iterations |
[in] | lrmax | maximum learning rate of iterations |
[in] | lrtim | total number of learning rate steps |
[in] | epoch | maximum number of epochs |
[in] | batch | batch size of data |
void a_regress_linear_pdm1 | ( | a_regress_linear const * | ctx, |
size_t | n, | ||
double const * | x, | ||
double * | pdm, | ||
double | y_mean ) |
calculate prediction deviation from mean for linear regression
[in] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n*coef_n], pdm[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in,out] | pdm | deviation, specified as a numeric vector |
[in] | y_mean | mean of response data |
void a_regress_linear_pdm2 | ( | a_regress_linear const * | ctx, |
size_t | n, | ||
double const *const * | x, | ||
double * | pdm, | ||
double | y_mean ) |
calculate prediction deviation from mean for linear regression
[in] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n][coef_n], pdm[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in,out] | pdm | deviation, specified as a numeric vector |
[in] | y_mean | mean of response data |
void a_regress_linear_sgd | ( | a_regress_linear * | ctx, |
double const * | x, | ||
double | y, | ||
double | alpha ) |
stochastic gradient descent for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | x | predictor data, specified as a numeric vector |
[in] | y | response data, specified as a numeric scalar |
[in] | alpha | learning rate for gradient descent |
void a_regress_linear_sgd1 | ( | a_regress_linear * | ctx, |
size_t | n, | ||
double const * | x, | ||
double const * | y, | ||
double | alpha ) |
stochastic gradient descent for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n*coef_n], y[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in] | y | response data, specified as a numeric vector |
[in] | alpha | learning rate for gradient descent |
void a_regress_linear_sgd2 | ( | a_regress_linear * | ctx, |
size_t | n, | ||
double const *const * | x, | ||
double const * | y, | ||
double | alpha ) |
stochastic gradient descent for linear regression
[in,out] | ctx | points to an instance of linear regression |
[in] | n | number of samples, x[n][coef_n], y[n] |
[in] | x | predictor data, specified as a numeric matrix |
[in] | y | response data, specified as a numeric vector |
[in] | alpha | learning rate for gradient descent |
void a_regress_linear_zero | ( | a_regress_linear * | ctx | ) |
zeroing for linear regression
[in,out] | ctx | points to an instance of linear regression |