summaryrefslogtreecommitdiff
path: root/source/tb_ml/tb_mh.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/tb_ml/tb_mh.h')
-rw-r--r--source/tb_ml/tb_mh.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/source/tb_ml/tb_mh.h b/source/tb_ml/tb_mh.h
new file mode 100644
index 0000000..91e1e7b
--- /dev/null
+++ b/source/tb_ml/tb_mh.h
@@ -0,0 +1,43 @@
1#ifndef TB_ML_H
2#define TB_ML_H
3
4
5//- supervised learning model by abdellah el morabit
6//- from <math.h>
7#define M_E 2.7182818284590452354 /* e */
8
9typedef struct training_sample trainig_sample;
10struct training_sample
11{
12
13};
14
15typedef struct prediction_data predicition_data;
16struct prediction_data
17{
18 f32 w;
19 f32 y;
20};
21
22
23typedef struct prediction_category prediction_category;
24struct category
25{
26 string8 name;
27 predicition_data data;
28};
29
30f(f32 d) {
31 return d * d;
32}
33
34internal f32
35derivative(f32 x, f32 (*f)(f32)) {
36
37 f32 h = 1e-6; // small interval to differnetiate the scope
38 return (f(x + h) - f(x - h)) / (2.0 * h);
39}
40
41
42
43#endif