Machine Learning: Intro
Tags: machinelearning
Published: 2019-08-20 16:36:30

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/mc0gblv9jxx1vlcbnepx.png)
 
In the world around us Algorithms surround us in our daily lives all the time, you might be reading this blog because of you searched something on google which put your search term through some algorithms and brought this Blog to you because I clearly understand machine learning at the highest level possible.... (NOT) 

Anyway when you click on this blog the algorithm takes note...when you visit facebook or youtube there is an algorithm that brings your the stuff you see on the home page based on stuff you like, when you buy something online there is an algorithm that is watching your purchase and making suggestions to you based on stuff other people may have purchased..


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/944vivd34a50seeb3xy5.png)

here you can see its college season and an algorithm has brought me stuff I might need when I go back to school...

Theres also algos at your bank watching transactions to make sure there aren't any fraudulent transactions..

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/s7mnw4cht9megihe6yr4.png)

And in the stock market there a bunch of bots trading with.... 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/hdo16inwi29z6xw7fkbl.png)


You guessed it! More bots..

So how do these algorithms work??

In the OLDSCHOOL days we built this algorithm bots with stuff we could explain like If (number === 1) {return number} and you would get the output "1"! 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/61onmetgdbq0598wmg5f.png)


But there are many problems in the world that we can not just write simple instructions for.. like for example there are billions of stock transactions happening in the world at once, how can a bot determine which one are legit and which ones are fraudulent?

Theres a BAJILLION videos on youtube which 8 should the bot bring to you to watch? in our daily world these bots are constantly being asked questions and They are giving us answers... now these might not be perfect answers but it is the best answer it knows that it can give us at the time and most of the time its pretty accurate! 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/nj8nr4y0dqkwhnww77eh.png)

However how do these bots work not really anyone knows.. including the people that "build" these bots 

This is because the companies that use these bots aren't only secretive about the information because these bots are very valuable employees to the company but they are also not completely sure themselves... see its similar to how a person learns if I point at a bee and tell you that it is a bee.. you are able to understand and now every time you see a bee hopefully you are able to tell that it is a bee and not one of those nasty wasps

but if I were to ask you how did you remember that was a bee.. you would be like IDK and if someone asked me how did I teach you that was a bee I would be like... uhhh IDK!
While an individual neuron in the brain and clusters of neurons in code may be understood.. the whole is beyond the grasp of our knowledge

this is kind of similar to how machine learning works on the basic level.


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/qrbqdzmpx4l2nws12yvj.png)


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1m8uutcr1r3zq1tg2o3a.png)

To begin we must first build a builder bot and teacher bot...
These bot brains are much simpler to understand and a really good programmer could make them given the time and effort. 
And their job? well its just like their name suggests.. 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/83oaedpghjo3e3k364lc.png)

The builder bot builds bots although its not very good at them, this is because the builder bot is building these robots towards a direction but almost at random... 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/xys6o5oew1jdiyo9ckk5.png)

this leads to some pretty... special student bots for the teacher bot to.. yes teach... however the teacher bot itself doesn't know the difference from a 3 and a Bee because if it did then... why is this blog even a thing?

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/k2cwzz1u1nwago2lbjfu.png)

Instead we give the teacher bot a bunch of 3 photos and a bunch of bee photos and the answer key to which is what. 

Teacher bot can't teach... but teacher bot sure as hell can test..

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/4c1yp9ka6j2lgu5zlkcr.png)

The student bots try really really hard on the test but they are bad at what they do.. like really bad.. like they can't even pass the tests...

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/qmk2unhlht55d8nnt6is.png)

And its not really their fault.. I mean after all they were made by a bot that doesn't know what a 3 and Bee is so how is it going to make a bot that knows what a 3 and Bee is while just making random connections in the bot brain.. So the poor little student bots take their bad tests home unlike me in 6th grade however they don't know the fate that awaits them...

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/k9gzler7h73vw2xavzmi.png)

The ones that did the best are put to one side... and well the others...

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/mcw9rlmrufpe8blvb8r4.png)


yeah...

anyway builder bot takes the ones that are left makes copies and makes a bunch of random changes again and sends these new bots off to school again.. some of them a little smarter 


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/3gwe77yg03fwv6fuq7aq.png)

And this cycle happens again... and again... and again... and again..

you may ask me hey Rohit, if the builder is building at random and teacher that doesn't teach and only tests, in theory shouldn't work or at the least it shouldn't be efficient.
Well you would be right, if we were working with just 1 or 13 bots like a regular school classroom and it took the builder bot real world time to build these new bots.

however teacher bot isn't just teaching any regular old 13 student classroom but instead its teaching an infinite warehouse of student bots
 
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/3gwe77yg03fwv6fuq7aq.png)

The test isn't just 10-15 questions but more like a million questions all asking whether something is a bee or a 3 and each bot is being taken back and built instantly with the "improvements" random or not when its a million random changes one of them has to eventually lucky enough to be barely tell the difference between a bee and a 3

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/kpkas0br09efvtpznqf3.png)


As the process keeps repeating the score keeps going higher and higher 
and the score required to survive keeps going higher and higher

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/47qieiprvperds78korr.png)

Eventually you do get a bot that can really tell the difference between a bee and a 3 from a picture it has never seen before 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/lefkh0fjbjfmqwofv8ce.png)

but how the student bot does this neither the builder bot or the teacher bot of the person who is overseeing this project know... after making so many random changes some useful some not the code for the bot gets very complicated...

While a single line of code and multiple functions may be understood the whole is beyond our grasp of knowledge.. 

And this can be frustrating because although the bot is doing what it has been taught to do very well... it is only good at that one thing and to teach it a new thing you would have to start the whole process over again with the new lesson implemented into the testing,
in our scenario the bot is very good at pictures but what happens if a picture is upside down or if its a video? the bot is stumped again... 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5j9697wu6c736ghhk6u8.png)

or things that are very clearly not a bee.. get put into the bee folder.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/efh8mvacty0a8wgqhczc.png)

and this why companies are always collecting data because now the human overseers have to write longer tests which more questions and try to include questions the best bots get wrong.. so when you click on the traffic signals in the picture to check if you are not a bot they are also collecting information to see what makes us humans different from the bots!

This is because more data means longer tests which means more efficient bots 

and this is the basics of how machine learning next we are going to talk about how this concept is used in combination with your ads that are being tracked to keep you on certain companies products longer DUN DUN DUN heres some words for thought if the student bot could learn to like the same stuff as you... would it be able to find you new stuff to keep being engaged?


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/jmww7d6xqo805eoijgal.png)


I would like to credit: https://www.youtube.com/watch?v=R9OHn5ZF4Uo

For the great pictures and awesome video on this topic in better depth and understanding would definitely go check it out!