#include <stdio.h>
#include <stdlib.h>
char err[512], dbg[512];
opts, x, y, 0.1, NULL);
printf("Training error: %s\nDebug info: %s\n", err, dbg);
return EXIT_FAILURE;
}
printf("Prediction error: %s\nDebug info: %s\n", err, dbg);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
int main()
Main function to execute batch gradient descent linear regression example.
Definition batch_gd.c:316
Core machine learning algorithms and configuration facilities.
Centralized error handling interface for the framework.
void dmlfw_get_error_string(char *error_string, uint32_t size)
Copies the last error message into the provided character buffer.
uint8_t dmlfw_error(void)
Checks if the last framework call resulted in an error.
void dmlfw_get_debug_string(char *debug_string, uint32_t size)
Copies detailed debug information about the last error into the provided character buffer.
dmlfw_column_vec_double * dmlfw_linear_regression_predict(dmlfw_mat_double *x, dmlfw_column_vec_double *model)
Predicts output using trained linear regression model.
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.
struct __dmlfw_mat_double dmlfw_mat_double
Opaque structure representing a double precision matrix.
Definition dmlfw_mat_double.h:73
void dmlfw_gradient_descent_options_set_number_of_iterations(dmlfw_gradient_descent_options *gd_options, uint64_t number_of_iterations)
Sets the number of iterations.
void dmlfw_gradient_descent_options_destroy(dmlfw_gradient_descent_options *gd_options)
Destroys a gradient descent options object and frees associated memory.
struct _dmlfw_gradient_descent_options dmlfw_gradient_descent_options
Opaque structure representing gradient descent configuration options.
Definition dmlfw_ml_configurations.h:121
dmlfw_gradient_descent_options * dmlfw_gradient_descent_options_create_new(void)
Creates a new gradient descent options object with default values.
void dmlfw_gradient_descent_options_set_learning_rate(dmlfw_gradient_descent_options *gd_options, double learning_rate)
Sets the learning rate.
void dmlfw_column_vec_double_destroy(dmlfw_column_vec_double *vector)
Destroys a column vector and frees its memory.
struct __dmlfw_column_vec_double dmlfw_column_vec_double
Opaque structure representing a column vector of doubles.
Definition dmlfw_vec_double.h:83