summaryrefslogtreecommitdiff
path: root/source/tb_ml/tb_mh.h
blob: 91e1e7bb3c3fff7fc1828cb9ece36e158bc1612a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef TB_ML_H
#define TB_ML_H


//- supervised learning model by abdellah el morabit
//- from <math.h>
#define M_E  2.7182818284590452354	/* e */

typedef struct training_sample trainig_sample;
struct training_sample
{

};

typedef struct prediction_data predicition_data;
struct prediction_data
{
    f32     w;
    f32     y;
};


typedef struct prediction_category prediction_category;
struct category
{
    string8 name;
    predicition_data data;
};

f(f32 d) {
    return d * d;
}

internal f32
derivative(f32 x, f32 (*f)(f32)) {

  f32 h = 1e-6; // small interval to differnetiate the scope
  return (f(x + h) - f(x - h)) / (2.0 * h);
}



#endif