Machine Learning (ML) models play a crucial role in modern software. Testing modern software should include testing the ML models. The design of the ML model is outside the lab's scope. Only ML testing will be covered. Different problems will be considered. For each problem type, corresponding metrics are utilized.
https://github.com/zubxxr/SOFE3980U-Lab4
The goal is to estimate the value of a continuous variable,
where
The folder /SVCR within the GitHub repository contains a Maven-managed Java program. The program reads a CSV file called model_1.csv, and displays the first ten lines of the CSV data using a library called com.opencsv. The POM file has been updated to include the library as a dependency and has been configured to be included in the JAR file. Type the following command to build the program after downloading it from the GitHub repository.
mvn clean package assembly:singleand the following line to execute the program
java -jar target/SVCR-1.0.0-jar-with-dependencies.jarThe model_1.csv file consists of two columns, true and predicted. Those are the validation results of an ML model. The /SVCR folder also contains the validation results of two other models in model_2.csv and model_3.csv.
- Update the Java program to calculate the MSE, MAE, and MARE for all the data stored in the model_1.csv file.
- Repeat the metrics evaluation for the validation results from the model_2.csv and model_3.csv files.
- Figure out the model with the lower error and recommend it.
for model_1.csv
MSE =112.09929
MAE =8.447413
MARE =0.12452688
for model_2.csv
MSE =102.97186
MAE =8.1291275
MARE =0.119408615
for model_3.csv
MSE =410.53354
MAE =16.090708
MARE =0.23739375
According to MSE, The best model is model_2.csv
According to MAE, The best model is model_2.csv
According to MARE, The best model is model_2.csv
It's similar to the single-variable continuous regression problem except that the output variable has two values: either zero or one,
The default value of the threshold is 0.5. a binary cross-entropy (BCE) is a metrics to evaluate the model.
Another metrics is confusion matrix which is summarized by the following figure in which TP, FP, TN, and FN stand for True positive, False Positive, True Negative, and False Negative, repectively.
A better model has a smaller BCE and larger Accuracy, Precision, Recall, and
The following procedure calculates the
for i=0:100
The Area under the curve, AUC-ROC, is calculated to evaluate the ROC curve using the following procedure.
auc=0
for i=1:100
0.5 AUC-ROC value means random guessing. Increasing the AUC-ROC values means an improvement in the model performance. A perfect model has an AUC-ROC value of about 1.
The folder /SVBR within the GitHub repository contains a Maven-managed Java program. The program reads a CSV file called model_1.csv and displays the first ten lines of the CSV data. Type the following command to build the program after downloading it from the GitHub repository.
mvn clean package assembly:singleand the following line to execute the program
java -jar target/SVBR-1.0.0-jar-with-dependencies.jarThe model_1.csv file consists of two columns, true and predicted. Those are the validation results of an ML model. The /SVBR folder also contains the validation results of two other models in model_2.csv and model_3.csv.
- Update the Java program to calculate the BCE, confusion matrix, Accuracy, Precision, Recall,
$F1_{\text{score}}$ , and AUC-ROC for all the data stored in the model_1.csv file. - Repeat the metrics evaluation for the validation results from the model_2.csv and model_3.csv files.
- Figure out and report the model with better performance.
for model_1.csv
BCE =2.2763095
Confusion matrix
y=1 y=0
y^=1 4283 780
y^=0 779 4158
Accuracy =0.8441
Precision =0.8459411
Recall =0.84610826
f1 score =0.84510297
auc roc =0.92142826
for model_2.csv
BCE =2.0675077
Confusion matrix
y=1 y=0
y^=1 4497 504
y^=0 565 4434
Accuracy =0.8931
Precision =0.89922017
Recall =0.88838404
f1 score =0.89073575
auc roc =0.9595736
for model_3.csv
BCE =1.7763017
Confusion matrix
y=1 y=0
y^=1 4833 225
y^=0 229 4713
Accuracy =0.9546
Precision =0.95551604
Recall =0.95476097
f1 score =0.9546805
auc roc =0.99116313
According to BCE, The best model is model_3.csv
According to Accuracy, The best model is model_3.csv
According to Precision, The best model is model_3.csv
According to Recall, The best model is model_3.csv
According to F1 score, The best model is model_3.csv
According to AUC ROC, The best model is model_3.csv
It's a different ML problem in which the output is one of a set of
Cross entropy can be calculated to evaluate this type of model.
A confusion matrix is constructed, as shown in the following figure.
The folder /MCC within the GitHub repository contains a Maven-managed Java program. The program reads a CSV file called model.csv and displays the first ten lines of the CSV data. Type the following command to build the program after downloading it from the GitHub repository.
mvn clean package assembly:singleand the following line to execute the program
java -jar target/MCC-1.0.0-jar-with-dependencies.jarThe model.csv file consists of six columns. The first is actual class
- Update the Java program to calculate the CE and confusion matrix for all the data stored in the model.csv file.
CE =1.0077125
Confusion matrix
y=1 y=2 y=3 y=4 y=5
y^=1 505 148 197 145 33
y^=2 35 1906 238 144 37
y^=3 35 139 2886 126 33
y^=4 28 136 202 1944 32
y^=5 44 130 237 139 501
Compare accuracy, recall, and precision by describing the interpretation of each of them. Using examples to show which one of them is more important than the others.
- A GitHub link of the code of the three tasks
- Report about the discussion part and the results of the tasks


