Simon gets serious with Linear Regression (Machine Learning)

Simon has been working on a very complicated topic for the past couple of days: Linear Regression. In essence, it is the math behind machine learning.

Simon was watching Daniel Shiffman’s tutorials on Linear Regression that form session 3 of his Spring 2017 ITP “Intelligence and Learning” course (ITP stands for Interactive Telecommunications Program and is a graduate programme at NYU’s Tisch School of the Arts).

Daniel Shiffman’s current weekly live streams are also largely devoted to neural networks, so in a way, Simon has been preoccupied with related stuff for weeks now. This time around, however, he decided to make his own versions of Daniel Shiffman’s lectures (a whole Linear Regression playlist), has been busy with in-camera editing, and has written a resume of one of the Linear Regression tutorials (he actually sat there transcribing what Daniel said) in the form of an interactive webpage! This Linear Regression webpage is online at: https://simon-tiger.github.io/linear-regression/ and the Gragient Descent addendum Simon made later is at:  https://simon-tiger.github.io/linear-regression/gradient_descent/interactive/ and https://simon-tiger.github.io/linear-regression/gradient_descent/random/

And here come the videos from Simon’s Liner Regression playlist, the first one being an older video you may have already seen:

Here Simon shows his interactive Linear Regression webpage:

A lecture of Anscombe’s Quartet (something from statistics):

Then comes a lecture on Scatter Plot and Residual Plot, as well as combining Residual Plot with Anscombe’s Quartet, based upon video 3.3 of Intelligence and Learning. Simon made a mistake graphing he residual plot but corrected himself in an addendum (end of the video):

Polynomial Regression:

And finally, Linear Regression with Gradient Descent algorithm and how the learning works. Based upon Daniel Shiffman’s tutorial 3.4 on Intelligence and Learning:

DSC_0557

 

 

Coding Train

Yesterday Simon got a parcel from the US: Simon’s hero, NYU professor Daniel Shiffman sent him a beautiful gift – a Coding Train shirt! Coding Train is Daniel Shiffman’s channel on YouTube where he records tutorials, coding challenges and live streams. Basically, Coding Train has been Simon’s main learning source in Programming, Math and Physics (and English!) for months.

DSC_0536

DSC_0537

DSC_0538

DSC_0539

Simon explains Linear Regression (Machine Learning)

In the two videos below Simon writes a JavaScript program using Linear Regression in Atom and gives a whiteboard lecture on the Linear Regression algorithm, both following a tutorial on Linear Regression by Daniel Shiffman.

Simon made a mistake in the formula using the sigma operator. He corrected it later. It should be i=1 (not i=0).

DSC_0548

DSC_0549

DSC_0551

 

Magnitude of a 3D vector

Here Simon explains how to calculate the magnitude of a 3D vector. This is something he partially figured out on his own and partially learned from Daniel Shiffman’s tutorial on Trigonometry and Polar Coordinates.

 

DSC_0540

Simon solved the bug in his Bit Invader game!

Simon actually managed to solve the bug in his Bit invader code! This is a game he was translating from Codea into JavaScript, we have already published a blog post about it here.

The project is available on Simon’s page in Codepen:

https://codepen.io/simontiger/project/editor/AdyVmr/

In the two videos below Simon explains what the bug was (he had forgotten a “break” statement). He insisted I include both videos, but actually only the second one is informative:

 

Simon still needs to add explosions to this game (make the enemies explode), so there will probably be a follow-up on this one.

 

Translating Car On Terrain project from Phaser.io into Processing

Today Simon spent hours translating this Car On Terrain project from Phaser.io (where it appears in JavaScript) into Processing (Java). He loved doing it in a form of a lesson for me, while I was filming him and asking questions about loops, arrays, fixtures, shapes and bodies (and there are many things I don’t understand). Simon also spoke about “the three most important properties: density, friction and restitution”. The project involved a lot of Physics, using many Box2D sub-libraries and translating between pixels and mm.

In the end, he got tired of writing all the coordinates for the terrain vertices, but he did get quite far.

 

 

 

 

 

Applying Box2D to translate from pixels into mm:

CarOnTerrain translating from pixels into mm

Translating Bit Invader from Codea into JavaScript

Simon tried to reconstruct Bit Invader game (from Codea.io) in JavaScript, but got stuck at a certain point when he was programming the enemy to recognize the hero and the bullets. Here is how far he got. The project is available on Simon’s page in Codepen:

https://codepen.io/simontiger/project/editor/AdyVmr/

 

Old men from the 19th century

Almost every evening, before going to bed, we are reading books and Simon mostly prefers math adventures. Russian author Vladimir Levshin (1904-1984) published several books about geometry, algebra and math history, with numbers and letters as the leading characters. Most chapters contain complicated riddles that we solve along the way. Sometimes, Simon gets up to fetch some paper and pencils to write down what he thinks the formula or the geometrical pattern should be for a particular story. And because Levshin’s books often mention famous mathematicians of the past, I see Simon learn about history through math. What he knows about Ancient Greece or the 1970’s mainly comes from his interest in early math and geometry or the dawn of computer science.

A couple days ago we were reading about George Boole, yet another example of someone way ahead of his time (200 years to be precise), the inventor of Boolean algebra. Simon was so excited when he recognized his name, and the name of Georg Cantor, a German mathematician, whose work was just as shocking to his contemporaries as Boole’s work was. Simon recognized both of their names because of his programming. This way, a connection was traced in his mind between these two 19th century men and today’s cutting edge projects in Java and JavaScript.

Here Simon was drawing his impressions of Cantor’s set theory, inspired by a passage about him in Levshin’s book:

DSC_0466

 

Levshin’s book that we’re reading now:DSC_0467

Passage on Boole and Cantor:

DSC_0468

DSC_0469

Another book by Levshin we have recently read, about Algebra:

DSC_0474

A chapter from that book talking about finding a sum of all the members of an arithmetic progression:

DSC_0470

DSC_0471

Simon stormed out the bedroom and came back with a sheet of paper where he wrote down the formula, before we read about it in the book (he often tries to come up with his own formulas):

DSC_0473

The same formula in the book:

DSC_0472

Looking for math everywhere

Funny how, even when training some pretty straightforward (and boring) arithmetic or Dutch reading, Simon tries to introduce more complex notions like here,

the floor, ceiling and round functions while solving a simple arithmetic word problem:

DSC_0450

DSC_0452

and lexicographic order, while sequencing Dutch story sentences:

DSC_0457