aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorjvech <jmvalenciae@unal.edu.co>2024-07-24 15:31:02 -0500
committerjvech <jmvalenciae@unal.edu.co>2024-07-24 15:31:02 -0500
commitd45581c0b067b9526ce88ba9d3a1bd861f4ff7cc (patch)
treea907346b2b282437537d7f4f6b138b3efddcce22 /src/util.c
parentb9deaf6ec1ba587f2b81a63c75b696c6def33436 (diff)
add: file_read() and format integraded on main program
things implemented: - read output in false bug was solved. - Make generic rule added to build test executables - format option added to the CLI
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index cd87d5c..8a7924f 100644
--- a/src/util.c
+++ b/src/util.c
@@ -91,11 +91,12 @@ void usage(int exit_code)
{
FILE *fp = (!exit_code) ? stdout : stderr;
fprintf(fp,
- "Usage: ml train [Options] JSON_FILE\n"
+ "Usage: ml train [Options] FILE\n"
" or: ml predict [-o FILE] FILE\n"
"\n"
"Options:\n"
" -h, --help Show this message\n"
+ " -f, --format=FORMAT File input and/or output format\n"
" -a, --alpha=ALPHA Learning rate (only works with train)\n"
" -e, --epochs=EPOCHS Epochs to train the model (only works with train)\n"
" -o, --output=FILE Output file (only works with predict)\n"
@@ -111,6 +112,7 @@ void util_load_cli(struct Configs *ml, int argc, char *argv[])
static struct option long_opts[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
+ {"format", required_argument, 0, 'f'},
{"epochs", required_argument, 0, 'e'},
{"alpha", required_argument, 0, 'a'},
{"output", required_argument, 0, 'o'},
@@ -120,7 +122,7 @@ void util_load_cli(struct Configs *ml, int argc, char *argv[])
int c;
while (1) {
- c = getopt_long(argc, argv, "hvc:e:a:o:i:l:", long_opts, NULL);
+ c = getopt_long(argc, argv, "hvc:e:a:o:i:f:", long_opts, NULL);
if (c == -1) {
break;
@@ -138,6 +140,9 @@ void util_load_cli(struct Configs *ml, int argc, char *argv[])
case 'c':
ml->config_filepath = optarg;
break;
+ case 'f':
+ ml->file_format = optarg;
+ break;
case 'h':
usage(0);
case 'v':
Feel free to download, copy and edit any repo