aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorjvech <jmvalenciae@unal.edu.co>2023-10-21 21:43:36 -0500
committerjvech <jmvalenciae@unal.edu.co>2023-10-21 21:43:36 -0500
commit17b2cf8dc274f950865911185fc4c6a9ccf915d5 (patch)
tree81f11089540264ebdf187ba028a58ed7f57a34c3 /src/util.c
parent8abcac7b3b42609f349b8a9cb132bae9746ba576 (diff)
setup: man page improved
Documentation: Example sections was improved Files sections was added Fixes: default config filepath was fixed
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/util.c b/src/util.c
index 8c7ec14..cd87d5c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -83,7 +83,7 @@ void version()
"the Free Software Foundation, either version 3 of the License, or\n"
"(at your option) any later version.\n\n"
);
- printf("Written by vech\n");
+ printf("Written by jvech\n");
exit(0);
}
@@ -93,17 +93,14 @@ void usage(int exit_code)
fprintf(fp,
"Usage: ml train [Options] JSON_FILE\n"
" or: ml predict [-o FILE] FILE\n"
- "Train and predict json data\n"
"\n"
"Options:\n"
" -h, --help Show this message\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"
+ " -c, --config=FILE Configuration filepath [default=~/.config/ml/ml.cfg]\n"
"\n"
- "Examples:\n"
- " $ ml train -e 150 -a 1e-4 housing.json\n"
- " $ ml predict housing.json -o predictions.json\n"
);
exit(exit_code);
}
@@ -117,12 +114,13 @@ void util_load_cli(struct Configs *ml, int argc, char *argv[])
{"epochs", required_argument, 0, 'e'},
{"alpha", required_argument, 0, 'a'},
{"output", required_argument, 0, 'o'},
+ {"config", required_argument, 0, 'c'},
{0, 0, 0, 0 },
};
int c;
while (1) {
- c = getopt_long(argc, argv, "hve:a:o:i:l:", long_opts, NULL);
+ c = getopt_long(argc, argv, "hvc:e:a:o:i:l:", long_opts, NULL);
if (c == -1) {
break;
@@ -137,6 +135,9 @@ void util_load_cli(struct Configs *ml, int argc, char *argv[])
case 'o':
ml->out_filepath = optarg;
break;
+ case 'c':
+ ml->config_filepath = optarg;
+ break;
case 'h':
usage(0);
case 'v':
Feel free to download, copy and edit any repo