dmlfw (Daniyal Machine Learning Framework)

Tests a linear regression model by predicting and evaluating accuracy using R2 score. More...

#include <stdio.h>
#include <dmlfw.h>
#include <stdlib.h>
Include dependency graph for gd_test_model.c:
void load_dataset (dmlfw_mat_double **x, dmlfw_column_vec_double **y, dmlfw_column_vec_double **model)
 Loads test dataset features X, target values Y, and model parameters.
 
int main (int argc, char *argv[])
 Main function to run the model testing example.
 
char * MODEL
 
void print_error_and_exit ()
 Prints the ml-framework error string and exits the program.
 
#define TESTING_DATASET   "IceCreamSales_testing_examples.csv"
 

Detailed Description

Tests a linear regression model by predicting and evaluating accuracy using R2 score.

Author
Mohammed Daniyal
Version
1.0
Date
2025-09-26

This tool loads a test dataset and pre-trained model parameters, makes predictions using ml-framework linear regression prediction functionality, computes the R2 accuracy score, and prints the result. It also handles errors and resource cleanup.

Usage: ./gd_test_model model_csv_file

Parameters:

Macro Definition Documentation

◆ TESTING_DATASET

#define TESTING_DATASET   "IceCreamSales_testing_examples.csv"

Function Documentation

◆ load_dataset()

void load_dataset ( dmlfw_mat_double **  x,
dmlfw_column_vec_double **  y,
dmlfw_column_vec_double **  model 
)

Loads test dataset features X, target values Y, and model parameters.

The dataset used is fixed to IceCreamSales_testing_examples.csv. A bias column of all 1.0 is prepended to features.

Parameters
[out]xPointer to features matrix pointer.
[out]yPointer to target column vector pointer.
[out]modelPointer to model parameters vector pointer.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Main function to run the model testing example.

Loads dataset and model, performs prediction, computes accuracy using R2 score, prints accuracy, and manages resources.

Parameters
argcArgument count.
argvArgument vector.
Returns
0 on success or error.

◆ print_error_and_exit()

void print_error_and_exit ( )

Prints the ml-framework error string and exits the program.

Variable Documentation

◆ MODEL

char* MODEL