diff options
author | jvech <jmvalenciae@unal.edu.co> | 2024-09-21 14:46:03 -0500 |
---|---|---|
committer | jvech <jmvalenciae@unal.edu.co> | 2024-09-21 14:46:03 -0500 |
commit | e3040135a5e51baab04070e04f86c22df2867c5c (patch) | |
tree | 0e53f2a649d3096a14a4e1772472463f5e968d7a | |
parent | 3fc51ee0c8135d95ec422dadd6562bf97261a757 (diff) |
The only concern I have with this file is having the program version
matching with the actual program, but it is not critical
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | doc/ml.1 | 4 | ||||
-rw-r--r-- | doc/ml_config.5 | 179 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/util.c | 2 |
6 files changed, 186 insertions, 7 deletions
@@ -5,7 +5,8 @@ objs/ doc/* !doc/*.pdf !doc/*.tex -!doc/*.1 +!doc/ml.1 +!doc/ml_config.5 *.gdb utils/*.gpi *.bin @@ -38,6 +38,7 @@ install: all @#man page install -d $(MANPREFIX)/man1 install -m 644 doc/ml.1 $(MANPREFIX)/man1/ml.1 + install -m 644 doc/ml_config.5 $(MANPREFIX)/man5/ml_config.5 install_config: mkdir -p ~/.config/ml @@ -46,6 +47,7 @@ install_config: uninstall: rm -v $(BINPREFIX)/${BIN} rm -v $(MANPREFIX)/man1/ml.1 + rm -v $(MANPREFIX)/man5/ml_config.5 man: build help2man -N ./ml -I doc/man.txt > doc/ml.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH ML "1" "September 2024" "ml 0.2.0" "User Commands" +.TH ML "1" "September 2024" "ml 0.5.0" "User Commands" .SH NAME -ml \- manual page for ml 0.2.0 +ml \- manual page for ml 0.5.0 .SH SYNOPSIS .B ml [\fI\,re\/\fR]\fI\,train \/\fR[\fI\,Options\/\fR] \fI\,FILE\/\fR diff --git a/doc/ml_config.5 b/doc/ml_config.5 new file mode 100644 index 0000000..f50d568 --- /dev/null +++ b/doc/ml_config.5 @@ -0,0 +1,179 @@ +.TH ML_CONFIG "5" "September 2024" "ml 0.5.0" "Configuration file" + +.SH NAME +ml_config - ml configuration file + +.SH DESCRIPTION +.PP +ml configuration file format consists of lines of key-value options grouped in +multiple sections as is shown below in the demo configuration file: +.PP + +.EX +.RS 4 +; comments +[net] +loss = square ; options (square) +epochs = 500 ; comment +batch = 32 +alpha = 1 +weights_path = utils/weights.bin +inputs = sepal_length,sepal_width,petal_length,petal_width +labels = species + + +[categorical_fields] +species=setosa,versicolor,virginica + +[preprocessing] +onehot=species + + +[layer] +neurons=10 +; options (relu, sigmoid, softplus, leaky_relu, linear, tanh) +activation=sigmoid + +[outlayer] +activation = sigmoid +.RE +.EE + +.SS [net] +.PP +In this section you describe general network configurations more specifically +its training parameter, weights filepath and input and output columns. + +.TS +box nospaces center tab(|); +L L L +Lb L L. +Key | Description | Type +_ +alpha | learning rate | decimal +loss | loss function | option (string) +epochs | training epochs | integer +batch | batch size | integer +weights_path | weights filepath | string +inputs | input fields | list (string) +labels | label fields | list (string) +.TE + +.SS [preprocessing] +Indicate preprocessing operations for input or label fields + + +.TS +box nospaces center tab(|); +L L L +Lb L L. +Key | Description | Type +_ +onehot | onehot columns | list (string) +.TE + +.PP +Categorical preprocessing like operations +.B onehot +require to have their fields specified in +.B [categorical_fields]. +otherwise the program will prompt you an error message. + + +.SS [categorical_fields] +.PP +This section is kind of special, here you must set the possible values a field +can take. taking the first example as reference: + +.EX +.RS +[categorical_fields] +species=setosa,versicolor,virginica +.RE +.EE + +the column +.B species +can only take the values +.B setosa,versicolor +and +.B virginica, +if the program encounters a different value it will stop its execution. + +.SS [layer] +.SS [outlayer] +.PP +Create a layer component. +.B [outlayer] +section does not require +.B neurons +parameter. +.TS +box nospaces center tab(:); +L L L +Lb L L. +Key : Description : Type +_ +neurons : number of neurons : integer +activation : activation function : option (string) +.TE + +.PP +The topology of the network depends of the order in which +.B [layer] +, is put on the file, the program will load each +.B [layer] +section sequentially. For instance the following example: +.PP + +.EX +.RS +[layer] +neurons=10 +activation=relu + +[layer] +neurons=20 +activation=sigmoid + +[outlayer] +activation = sigmoid +.RE +.EE + +will produce a network with the following topology +.TS +nospaces center tab(:); +Lb | Lb +L | L. +Activation : Dimension +_ +ReLu : in \[mu] 10 +Sigmoid : 10 \[mu] 20 +outlayers : 20 \[mu] out +.TE + +.SH FILES +.PP +The configuration file is searched in the following order: +.PP +.PD 0 +.IP \(bu 4 +CLI filepath +.IP \(bu 4 +ML_CONFIG_PATH env variable +.IP \(bu 4 +$HOME/.\&config/ml/ml.cfg +.PP + +.SH AUTHOR +Written by jvech + +.SH COPYRIGHT +Copyright \(co 2024 jvech + +.PP +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. @@ -31,9 +31,6 @@ #define MAX_FILE_SIZE 536870912 //1<<29; 0.5 GiB -#define ARRAY_SIZE(x, type) sizeof(x) / sizeof(type) - - void load_config(struct Configs *cfg, int n_args, ...) { char *filepath; @@ -80,7 +80,7 @@ char *e_strdup(const char *s) void version() { - printf("ml 0.2.0\n"); + printf("ml 0.5.0\n"); printf( "Copyright (C) 2023 jvech\n\n" "This program is free software: you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" |