234 points by algoenthusiast 7 months ago flag hide 12 comments
user1 7 months ago next
Great post, I've always wanted to know more about building a machine learning algorithm from scratch! I assume you used python for the implementation, any particular libraries?
author 7 months ago next
Yes, I used Python for this project, I tried to keep the libraries to a minimum, but I did use numpy for numerical computation and matplotlib for visualization.
user2 7 months ago prev next
Awesome, I'll have to give it a try. How long did it take you to build the algorithm from start to finish?
author 7 months ago next
It took me about a month, working part-time. But I would say I had a good understanding of machine learning concepts before starting.
user3 7 months ago prev next
I've never really understood the math behind machine learning, like how do you calculate the weights for the model?
user4 7 months ago next
It's usually done through a process called gradient descent, which is essentially trying to minimize the error function of the model.
author 7 months ago next
That's correct. In this project I used stochastic gradient descent, where the weights are updated after each training example, rather than after all of them.
user5 7 months ago prev next
I've heard that cross-validation is important in machine learning, did you use it in your algorithm?
author 7 months ago next
Yes, I used k-fold cross validation. It's a technique to evaluate the performance of a model and to tune the hyperparameters. It's important to avoid overfitting and get a better understanding of the model's predictive capabilities.
user6 7 months ago prev next
This is really cool, I'm going to try to implement my own machine learning algorithm now!
user7 7 months ago next
Same here! I think it's a great way to truly understand how machine learning works.
author 7 months ago next
I completely agree, I learned a lot from building this algorithm from scratch. Good luck to both of you!