dmlfw (Daniyal Machine Learning Framework)
|
Gradient descent-based linear regression training and prediction. More...
Go to the source code of this file.
Gradient descent-based linear regression training and prediction.
This module provides APIs to fit linear regression models using batch, stochastic, and mini-batch gradient descent methods, including support for regularization and user-defined progress callbacks. It also offers prediction functionality from trained models.
Functions use centralized error reporting. Call dmlfw_error()
after function execution to check for errors. For error details, use dmlfw_get_error_string()
and dmlfw_get_debug_string()
.
Returned vectors representing trained models or predictions must be freed using the vector destroy API to avoid memory leaks.
dmlfw_column_vec_double * dmlfw_linear_regression_fit_using_batch_gradient_descent | ( | dmlfw_gradient_descent_options * | gd_options, |
dmlfw_mat_double * | x, | ||
dmlfw_column_vec_double * | y, | ||
double | regularization_parameter, | ||
dmlfw_column_vec_double * | model | ||
) |
Fits linear regression model using batch gradient descent.
gd_options | [in] Gradient descent options (non-NULL). |
x | [in] Feature matrix (non-NULL). |
y | [in] Target vector (non-NULL). |
regularization_parameter | [in] L2 regularization coefficient. |
model | [in,out] Optional initial model vector or NULL. |
Usage example:
dmlfw_column_vec_double * dmlfw_linear_regression_fit_using_mini_batch_gradient_descent | ( | dmlfw_gradient_descent_options * | gd_options, |
double | regularization_parameter, | ||
dmlfw_column_vec_double * | model | ||
) |
Fits linear regression model using mini-batch gradient descent.
gd_options | [in] Gradient descent options (non-NULL). |
regularization_parameter | [in] L2 regularization coefficient. |
model | [in,out] Optional initial model vector or NULL. |
dmlfw_column_vec_double * dmlfw_linear_regression_fit_using_stochastic_gradient_descent | ( | dmlfw_gradient_descent_options * | gd_options, |
double | regularization_parameter, | ||
dmlfw_column_vec_double * | model | ||
) |
Fits linear regression model using stochastic gradient descent.
gd_options | [in] Gradient descent options (non-NULL). |
regularization_parameter | [in] L2 regularization coefficient. |
model | [in,out] Optional initial model vector or NULL. |
dmlfw_column_vec_double * dmlfw_linear_regression_predict | ( | dmlfw_mat_double * | x, |
dmlfw_column_vec_double * | model | ||
) |
Predicts output using trained linear regression model.
x | [in] Feature matrix (non-NULL). |
model | [in] Trained model vector (non-NULL). |
Usage example: