diff options
author | jvech <jmvalenciae@unal.edu.co> | 2024-07-26 09:47:52 -0500 |
---|---|---|
committer | jvech <jmvalenciae@unal.edu.co> | 2024-07-26 09:47:52 -0500 |
commit | ce0001538820d819bf965a24ffbb6f6e6269859c (patch) | |
tree | 4ae4de19596d8771ac0b4757f285e4f11fd94519 /src/util.c | |
parent | d45581c0b067b9526ce88ba9d3a1bd861f4ff7cc (diff) |
add: file_write() implemented
things implemented:
- CLI option --only-out added
- CLI option --format works more intuitively
- csv tsv and json output support
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -92,14 +92,15 @@ void usage(int exit_code) FILE *fp = (!exit_code) ? stdout : stderr; fprintf(fp, "Usage: ml train [Options] FILE\n" - " or: ml predict [-o FILE] FILE\n" + " or: ml predict [-Ohv] [-f FORMAT] [-o FILE] FILE\n" "\n" "Options:\n" " -h, --help Show this message\n" - " -f, --format=FORMAT File input and/or output format\n" + " -f, --format=FORMAT Define input or output FILE format if needed\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" + " -O, --only-out Don't show input fields (only works with predict)\n" " -c, --config=FILE Configuration filepath [default=~/.config/ml/ml.cfg]\n" "\n" ); @@ -117,12 +118,13 @@ void util_load_cli(struct Configs *ml, int argc, char *argv[]) {"alpha", required_argument, 0, 'a'}, {"output", required_argument, 0, 'o'}, {"config", required_argument, 0, 'c'}, + {"only-out", no_argument, 0, 'O'}, {0, 0, 0, 0 }, }; int c; while (1) { - c = getopt_long(argc, argv, "hvc:e:a:o:i:f:", long_opts, NULL); + c = getopt_long(argc, argv, "hvOc:e:a:o:i:f:", long_opts, NULL); if (c == -1) { break; @@ -143,12 +145,18 @@ void util_load_cli(struct Configs *ml, int argc, char *argv[]) case 'f': ml->file_format = optarg; break; + case 'O': + ml->only_out = true; + break; case 'h': usage(0); + break; case 'v': version(); + break; default: usage(1); + break; } } |