How i hand-coded core Machine learning Algorithms from scratch in python, what i learned, and why you should too.



Machine learning is taking over the world, from your youtube recommendations to your favorite voice assistant, even in your cars and smartphone's camera!
I would say Machine learning is amongst the most widely discussed topics in recent time's media, right up there with Kylie Jenner and bezos' divorce ; )

The Premise, The Why.

Just like any field of science, Machine Learning too has certain basic concepts and algorithms that act as the fundamental building blocks of everything wonderful you see around you.

Fortunately or unfortunately, in Machine Learning, these algorithms have been made available to us for use as wonderfully optimized, properly packaged and easy-to-use abstractions, think sci-kit-learn. Import a classifier and well be on your way. we essentially treat and use them as BLACKBOXES!

Believe it or not, that is a MAGNIFICENT thing. This is a massive win for practicality, pragmatism and performance.

But like just your Algorithms teacher told you when you asked him/her

- why are we learning all these different sorting algorithms, when in practice you almost will never roll your own implementation? (This was a friend, totally not me)

The teacher pulls down his thick bifocal glasses slightly, looks at you, while marveling at your fantastic haircut, in his firm but empathetic voice, he replies

- Because the concepts you learn would be applicable to a wide range of problems in computer science and will help you understand other problems and concepts better.

I had no reply, i mean my friend had no reply, and was humbled.

The Agenda, The What.

In This talk, i will share with my audience, a crisp take on my journey of What i learned while hand-coding these fundamental machine learning algorithms from scratch.

  • YOU will learn what happens under-the-hood when you use these classifier algorithms and how they work.
  • YOU Will get familiar with the fundamental concepts and ideas that under-pin almost all of these classifiers and more.
  • YOU will also be introduced to the math behind these algorithms, further helping in understanding and demystifying them.

The algorithms i plan to cover are:-

1) The Perceptron algorithm (where it all began)  
2) ADALINE or adaptive linear neuron.  
3) Logistic Regression.  
4) IF time permits, Support Vector Machines.

There will also be python code (not live coding), from where I implemented and trained these algorithms, to formally understand what is happening and what does what, with illustrations where necessary. Trust me, this will be neat ; )

The Outcome

I would like my audience to leave with a clearer view and a greater appreciation of how machine learning happens in the real world, by focusing on what happens under-the-hood, when you pull that classifier out of your favorite machine learning library. The basic concepts that under-pin the fundamental classifiers and what machine learning algorithms try to do, and why it is OKAY to look into the so called blackboxes once in a while ; )


  1. Author Introduction and the premise of the talk. [2 minutes]

    • The Why and how it came to be.
  2. Demystifying Machine Learning [2-3 minutes]

    • Its much less Magic than you think it is. ✨
  3. The big picture of Machine Learning. [2-3 minutes]

    • The big picture ideas behind machine learning, setting up the audience nicely for the upcoming topics.
  4. Perceptron and ADALINE (ADAptive LInear NEuron) algorithms [7 minutes]

    • Understanding Perceptron, where it all started, and its extension the Adaline Algorithm, how they work, how to train them with relevant code and math.
  5. Logistic Regression Algorithm [7 minutes]

    • Explaining the LR algorithm, how it works, how to train it, what the parameters do, with accompanying python code and some necessary math.
  6. Summing up and outro [2 minutes]

    ---- 1 minute margin ----

  7. Q&A [5 minutes]

The 2 minute casual video for the talk, as asked by the administration can be found here



The slide deck can be found at the repo here. It is Work under progress.


Basic Understanding of python, school level math.
Basic Understanding of some linear algebra is encouraged but not necessary.

Content URLs:

Slides as pdf
Video pitch


I have already written detailed and illustrated posts about these algorithms on my personal blog, which anyone wishing to read can find at:-

Respective Posts:-

1) Understanding Logistic Regression
2) Adaptive Linear Neuron (ADALINE)
3) Perceptron Learning Rule
4) Support Vector Machines

Speaker Info:


I am Arjun Kathuria, an independent software developer and hacker from New Delhi, India.

I was a Google summer of code student 2016 with jQuery Foundation.

I also held the position of the sole lead frontend software developer for a high growth startup in Bangalore from early 2017 to mid 2018, which i left to follow and pursue my other interests in computer science and music.

I am currently into python, machine learning, full-stack development projects, exploring lower level Kernel stuff and learning Rust.

Speaker Links:

You can find my:-

1) Github Profile, with all my open-source work and contributions.
My GSoC project - hammer.js - has upwards of 19,000 stars.

2) Personal Blog, where i post about stuff as i learn.
The posts for the machine learning algorithms are already there, with nice illustrations.

Id: 1049
Section: Data Science, Machine Learning and AI
Type: Talks
Target Audience: Intermediate
Last Updated: