summaryrefslogtreecommitdiff
path: root/source/tb_ml/tb_ml.c
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2026-04-19 18:38:51 +0200
committernasr <nsrddyn@gmail.com>2026-04-19 18:38:51 +0200
commit4bd3064b6571dec04d17d67b8e6fd3128ceb1f09 (patch)
tree28cd7e577d553c87956fc41f60100066637d21d7 /source/tb_ml/tb_ml.c
parent36dc1f859a13e428c441fc8f4f35550fe12ed72f (diff)
feature(main): working on the design. i dont know how machine learning works pfff...main
Diffstat (limited to 'source/tb_ml/tb_ml.c')
-rw-r--r--source/tb_ml/tb_ml.c58
1 files changed, 50 insertions, 8 deletions
diff --git a/source/tb_ml/tb_ml.c b/source/tb_ml/tb_ml.c
index cf9625a..8211a60 100644
--- a/source/tb_ml/tb_ml.c
+++ b/source/tb_ml/tb_ml.c
@@ -1,20 +1,62 @@
1#define BASE_UNITY 1#define BASE_IMPLEMENTATION
2#include "../base/base_include.h" 2#include "../base/base_include.h"
3 3
4#if 0 4#ifdef BTREE_IMPLEMENTATION
5internal void
6btree_collect(btree_node *node, (void *) *keys, (void *) array *) {
5 7
6#include "../third_party/btree_impl.h" 8 if (!n) return;
9
10 for (s32 index = 0; index < node->count; ++index)
11 {
12 TODO(nasr): traverse the tree to use the tree as training data
13 }
14}
7#endif 15#endif
8 16
9 17
18/**
19* calculating a derviate requires a building an algebraic system
20* so we do a dump approximation of what the derivative could be
21* we want this to be able to normalize the data which is necessary for proper training
22**/
23#if 1
24internal f32
25internal training_sample_data
26normalize_training_data_btree(btree *btree) {
27
28
29
30}
31
32#endif
10 33
11//- dataset is an implementation of the btree
12 34
13int main(int c, char **v) 35// using gradient descent
14{ 36internal void
15 unused(c); 37train(f32 *weights, b_tree, s32 learning_rate) {
16 unused(v); 38
39 btree_collect(btree_node *node, (void *) *keys, (void *) array *);
40
41 for (s32 epoch = 0; epoch < learning_rate; ++epoch)
42 {
43
44 }
45
46}
47
48internal f32
49predict(f32 b1, f32 b2) {
50 return b1 + (b2 * log(b1)) + M_E;
51}
52
53//- dataset is an implementation of the btree
54int main(void) {
17 55
56 for (s32 index = 0; index < 10; ++index)
57 {
58 printf("value [%4.f]\n",predict(10, 10));
59 }
18 60
19 return 0; 61 return 0;
20} 62}