r/learnmachinelearning • u/not-okarun • Nov 03 '26
I build xgboost for regression from scratch
Finally, after 5 days, XGBoost for regression is complete. Sklearnโs XGBoost is still faster than mine, but the accuracy for both is almost the same. Itโs Day 54 of Building Machine Learning Algorithms from Scratch.
379
Upvotes



80
u/Sherwith2per Nov 03 '26
I'm genuinely sorry for writing ML enthusiast on my LinkedIn (how many years have you been doing ML?)
23
u/AdministrativeTwo488 29d ago
Nevermind the other mean people man. Congrats! I remember my first model. Hidden markov model. I thought it would be difficult (and it was) but once you understand the math its easy. I love creating from scratch than using pre existing lib for academic purposes. Yk you can create your own customized lib if you write this in c++ and package it.
17
u/not-okarun 29d ago •
Well I don't care what people think I don't need praise or validation I just post to connect with people like me and build a network of people who are obsessed with coding, not just vibe coding don't get me wrong vibe coding is not a bad I'm not against it at all but tbh I love building things on my own. It's fun to build things I have completed so many algorithms and each one gets more complex than the previous one when I build something with my own hands understand things so closely to mathematics behind them I know why each thing exists and why it works the way it does many people say why are you building everything from scratch? import libraries there's no use
I'm just curious I'm trying to find answers to my own questions
One day, I was using ChatGPT and wondered how the heck did humans create something like this It's like magic and after doing a little research i realised it's not magic. It's mathematics under the hood that's the point where I started my journey in machine learning and when I started learning ML I had already made up my mind that I would build every algorithm from scratch And I'm doing it check my GitHub. I've built everything from scratch up to XGBoost regression tbh my implementations are not always optimised they're not the fastest the code structure isn't perfect and there are still bugs. but I feel proud because I built them myself ngl i do use AI sometime to fix one or two things but the rest is completely my own work sometimes building a single algorithm takes weeks even when I know all the theory figuring out where to start implementing it is a whole different challenge I try different approaches run errors, fix it, try again and repeat the same thing and somewhere along the way, I start figuring things out myself Like Oh, I got it it like this and all that's how I build things brick by brick i just want to make sure my foundation is strong enough before moving to deep learning and AI i'm not doing this to prove anything to anyone. I'm doing it because I'm genuinely curious about how things work and I love the process of figuring them out myself
It's like a journey I'm on the journey to find the answer and I don't use to post things but now I do it's like a diary, a record so ppl can see it. sometimes my post take a long because im watching one piece currently on 193ep no spoilers ๐คง
Thx for seeing my post where the grammar is broken it's because in school instead of understanding the grammar I used to read the sentence 3-4 times and which sound correct that's the answer ๐ฎโ๐จ. ma'am was right
2
u/Fluffy_white_fox 25d ago
Did you make it in your phone? My g collab browser rarely behaves normal for me to write anything on the phone version... How are you even doing it???
17
u/addictzz 29d ago
I really appreciate your effort for this. The work needed to understand the math and codify it is no small feat, especially if you don't use LLM to do all these.
I am learning to do the same with LLM help for transformer-based neural network.
9
u/XamanekMtz 29d ago
Building from scratch is a great exercise to learn many of the hows and whys, specially if you are more sided to the coding skills, nice job
15
u/ConsiderationNew3273 Nov 03 '26
How do we get started doing this type of thing?
5
u/Historical-Reach8587 29d ago
Nice job and post.
Have to say there are some real jerks posts in here. Some of you people must truly be miserable humans.
1
u/Natsuo_Subaru 26d ago
Actually, what's that?
2
u/burntoutdev8291 29d ago
Nice! I remember taking a while to understand gini haha
2
u/jenalimor1 28d ago
Awesome!
2
u/Nikhilodeon1 26d ago
on a phone top bruh ๐ญ๐ญ
2
u/imjerusalem 26d ago
Thanks. I can goon to ts now.
2
u/Fickle-Tradition2107 25d ago
Hi what is your IQ to be able to do this?
2
u/BenGiii888 18d ago
It's awesome dude congrats! Yeah we do use packages but this still still shows you how they work under the hood so its definitely great!
1
u/Acceptable_Break_179 11d ago
Great
0
u/[deleted] 29d ago
[deleted] โ view deleted comment
13
u/[deleted] Nov 03 '26
[removed] โ view removed comment