šŸŽ Checkout my Learn React by Making a Game course and get 1 month Free on Skillshare!

Machine Learning vs Classic Programming

Some while ago I've tried to give a short explanation of what machine learning is, from the perspective of a Javascript developer.

Meanwhile, I've discovered this video below which gives such great insight into machine learning vs the standard way of programming:

It's going into more details, but the main idea for me was that a classic way of programming is to write a function that gets some input and calculates an output, while machine learning works by knowing multiple inputs and outputs, and based on that it can deduct the actual function behavior.

So let's say I need to write a Javascript program that computes the square of a number.

In a classic programming approach, we will first write the function:

const f = (x) => x*x

And later user it:

const value = readValueFromKeyboard()
const result = f(value)

javascript Machine Learning compared with Classic Programming

While in a machine learning approach we will do something like this:

const inputs = [1, 2, 3, 4 /* more values here */]
const outputs = [1, 4, 9, 16 /* more values here */]
const f = trainModel(inputs, outputs)

And when the model is ready use can use it as before:

const value = readValueFromKeyboard()
const result = f(value)

javascript Machine Learning compared with Classic Programming

They should be used together as both the classic programming and the machine learning approaches have their own class of problems to which they should be applied.

šŸ“– 50 Javascript, React and NextJs Projects

Learn by doing with this FREE ebook! Not sure what to build? Dive in with 50 projects with project briefs and wireframes! Choose from 8 project categories and get started right away.

šŸ“– 50 Javascript, React and NextJs Projects

Learn by doing with this FREE ebook! Not sure what to build? Dive in with 50 projects with project briefs and wireframes! Choose from 8 project categories and get started right away.


Leave a Reply

Your email address will not be published. Required fields are marked *