feat: Update error message; update makefile; Update doc

This commit is contained in:
2024-09-29 22:57:06 +02:00
parent 442ebdd16c
commit 8b3dd78717
4 changed files with 18 additions and 8 deletions

7
use.c
View File

@ -1,3 +1,4 @@
#include "main.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -24,11 +25,11 @@ int main(int argc, char *argv[]) {
// Load weights and biases from CSV file
getvalues("weights.csv", HiddenWeights, HiddenBiases, FinalOutputWeights, FinalOutputBiases);
if (argc < 2) {
fprintf(stderr, "No arguments provided.\n");
errx(0, "No arguments provided. Usage: %s <input1> <input2>", argv[0]);
return EXIT_FAILURE;
}
if (argc != 3) {
fprintf(stderr, "Usage: %s <input1> <input2>\n", argv[0]);
errx(0, "Usage: %s <input1> <input2>", argv[0]);
return EXIT_FAILURE;
}
@ -78,7 +79,7 @@ int main(int argc, char *argv[]) {
void getvalues(char filename[], double **HiddenWeights, double *HiddenBiases, double **FinalOutputWeights, double *FinalOutputBiases) {
FILE *fp = fopen(filename, "r");
if (fp == NULL) {
errx(EXIT_FAILURE, "Could not open file %s", filename);
errx(EXIT_FAILURE, "Could not open file %s. Train the model first by executing ./main", filename);
}
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {