...

/

Programming versus Machine Learning

Programming versus Machine Learning

Distinguish between conventional programming and machine learning.

Objective

We’ll get an introduction to supervised learning in this chapter. Within a couple of chapters, we’ll code our first machine learning (or simply “ML”) system. Then we’ll evolve this system, one small step at a time, until it becomes powerful enough to read handwritten digits.

In the future, we are unlikely to ever write machine learning algorithms from scratch. But doing it once to grasp the fundamentals is priceless. We’ll understand every line in the final program. Machine learning will never look like magic again.

Comparison between ML and conventional programming

A program can be built to play video games by storing some rules which define how the game works. For example, some rules might define how enemies behave or how the user fires the weapon. These rules can then be encoded into a program that executes them if:

Press + to interact
enemy = get_nearest_enemy()
​​if​ enemy.distance() < 100:
decelerate()
​​ if​ enemy.is_shooting():
​ raise_shield()
​ else​:
​ ​if​ health() > 0.25:
​ shoot()
​ ​else​:
​ rotate_away_from(enemy)
​else​:
//# ...a lot more code​

Most of the code would be a big collection of if..else statements, mixed with imperative ...