From 4bd3064b6571dec04d17d67b8e6fd3128ceb1f09 Mon Sep 17 00:00:00 2001 From: nasr Date: Sun, 19 Apr 2026 18:38:51 +0200 Subject: feature(main): working on the design. i dont know how machine learning works pfff... --- source/tb_ml/tb_ml.c | 58 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 8 deletions(-) (limited to 'source/tb_ml/tb_ml.c') 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 @@ -#define BASE_UNITY +#define BASE_IMPLEMENTATION #include "../base/base_include.h" -#if 0 +#ifdef BTREE_IMPLEMENTATION +internal void +btree_collect(btree_node *node, (void *) *keys, (void *) array *) { -#include "../third_party/btree_impl.h" + if (!n) return; + + for (s32 index = 0; index < node->count; ++index) + { + TODO(nasr): traverse the tree to use the tree as training data + } +} #endif +/** +* calculating a derviate requires a building an algebraic system +* so we do a dump approximation of what the derivative could be +* we want this to be able to normalize the data which is necessary for proper training +**/ +#if 1 +internal f32 +internal training_sample_data +normalize_training_data_btree(btree *btree) { + + + +} + +#endif -//- dataset is an implementation of the btree -int main(int c, char **v) -{ - unused(c); - unused(v); +// using gradient descent +internal void +train(f32 *weights, b_tree, s32 learning_rate) { + + btree_collect(btree_node *node, (void *) *keys, (void *) array *); + + for (s32 epoch = 0; epoch < learning_rate; ++epoch) + { + + } + +} + +internal f32 +predict(f32 b1, f32 b2) { + return b1 + (b2 * log(b1)) + M_E; +} + +//- dataset is an implementation of the btree +int main(void) { + for (s32 index = 0; index < 10; ++index) + { + printf("value [%4.f]\n",predict(10, 10)); + } return 0; } -- cgit v1.3