dmlfw (Daniyal Machine Learning Framework)
|
Batch gradient descent linear regression example using polynomial features. More...
#define | ACTUAL_TRAINING_DATASET "trends_train.csv" |
#define | FREQUENCY_OF_PRINTING_COST 300000 |
dmlfw_gradient_descent_options * | get_gradient_descent_options () |
Creates gradient descent configuration for batch gradient descent. | |
FILE * | gnuplot |
#define | LEARNING_RATE 0.09 |
void | load_dataset (dmlfw_mat_double **x, dmlfw_column_vec_double **y) |
Loads features and target from scaled polynomial dataset with bias column. | |
int | main () |
Main program execution for polynomial batch gradient descent linear regression. | |
#define | MODEL_FILE_NAME "example-4-model.csv" |
#define | NUMBER_OF_ITERATIONS 300000000 |
int | on_iteration_complete (uint64_t iteration_number, void *y, void *predicted_y, void *model, double regularization_parameter) |
Callback invoked at each gradient descent iteration to log cost and update graphs. | |
void | print_error_and_exit () |
Prints ml-framework error and exits. | |
#define | REGULARIZATION_PARAMETER 0.0 |
#define | SHOW_GRAPH 1 |
#define | TRAINING_DATASET "scaled_poly_trends_train.csv" |
Batch gradient descent linear regression example using polynomial features.
This example trains a linear regression model on the scaled polynomial trends training dataset. It tracks training cost with optional graphing, uses regularization, and saves the trained model. Includes custom progress callback with gnuplot visualization.
Usage: ./polynomial_batch_gd
#define ACTUAL_TRAINING_DATASET "trends_train.csv" |
#define FREQUENCY_OF_PRINTING_COST 300000 |
#define LEARNING_RATE 0.09 |
#define MODEL_FILE_NAME "example-4-model.csv" |
#define NUMBER_OF_ITERATIONS 300000000 |
#define REGULARIZATION_PARAMETER 0.0 |
#define SHOW_GRAPH 1 |
#define TRAINING_DATASET "scaled_poly_trends_train.csv" |
dmlfw_gradient_descent_options * get_gradient_descent_options | ( | ) |
Creates gradient descent configuration for batch gradient descent.
void load_dataset | ( | dmlfw_mat_double ** | x, |
dmlfw_column_vec_double ** | y | ||
) |
Loads features and target from scaled polynomial dataset with bias column.
[out] | x | Pointer to features matrix pointer. |
[out] | y | Pointer to target column vector pointer. |
int main | ( | ) |
Main program execution for polynomial batch gradient descent linear regression.
int on_iteration_complete | ( | uint64_t | iteration_number, |
void * | y, | ||
void * | predicted_y, | ||
void * | model, | ||
double | regularization_parameter | ||
) |
Callback invoked at each gradient descent iteration to log cost and update graphs.
iteration_number | Current iteration index. |
y | Actual target vector. |
predicted_y | Predicted target vector. |
model | Current model parameters vector. |
regularization_parameter | Regularization coefficient. |
void print_error_and_exit | ( | ) |
Prints ml-framework error and exits.
FILE* gnuplot |