Machine Learning: If It’s Testable It’s Teachable
21700 Views | 5 Min Read
Ever wondered how you went to YouTube to watch just a 5 minutes video but ended up there for 3 hours? Or saw an advertisement on some page of exactly the same thing that you have been planning to buy for last 15 days and ended up finally buying it! Isn’t it great how your computer knows what you have been desiring? Well, it’s not your computer but the bots, the algorithmic bots that have been watching you all the time. Even now! Yes, that’s absolutely true. So the question comes, how these bots are made, and how software testing concepts come into play here.
It wasn’t very long ago when humans used to create algorithmic blogs that behaved like the real artificial intelligence. Simple and long code that basically said do this if this… or do that if that… for a while worked perfectly, and in many day to day activities it still works. However, as more and more people came on internet creating bigger and bigger datasets this approach simply didn’t work everywhere. Because some problems are just big enough to be taught by humans.
Let’s consider an example where you are shown two pictures one is of a dog and another is number 5 and you are asked what is what? Being an human you just know that yes, this is a dog and that is number 5 but how will the machine or the bots know?
We have to create a complex algorithm that will tell them to crawl the image pixel by pixel and find patterns in that picture that matches pixel patterns usually found in known dog images and give an estimated guess. Human brains have a complex wiring of neurons that learns every second. Similarly we will have to create complex bots with evolving pattern recognition intelligence which they develop over time as they keep learning.
How they learn?
Human programmers create a teacher bot and a builder bot who have simpler brains. Builder bot builds student bots and keeps and discards them based on their test grades.
The teacher bot himself cannot distinguish between a dog and a 5 but it can test student bots whether they are right in identifying or not. Now you get why automated testing is so important.
We give teacher bots a bunch of photos of dogs and 5s and an answer key of which is what. Based on this the teacher bot takes test of student bots and gives them the grades. Based on the test data, the builder bot keeps building on different student bots by adjusting different permutations and combinations of student bots algorithm mechanics, sometimes it even at random sees what sticks and what not. And the teacher bot keeps taking their tests and assigning them the grades. And the cycle continues.
The teacher bot keeps testing, and based on the grades of the student bots, the builder bot keeps the best performing bots and ruthlessly discards the rest.
The test, build, test cycle keeps on repeating in a loop and their grades are assessed and once the bot with approx 99.9% accuracy (or call them grades) is built the cycle is stopped.
Now the question that comes to our minds is ‘How many times the automated cycle of test, build, and test is repeated?’. Well, it repeats as many times it is necessary till the bot with the best grades is built. The best bot is the best algorithm to distinguish between a dog and 5.
So What’s The Problem?
Now we have picked up the best algorithm to distinguish between a dog and the number 5 then what is the problem that may occur? If we give the bot a video of a dog or 5 upside down or letter ‘S’ instead of 5 will the bot still be able to figure that out? No.
How to Solve it?
To solve this, the humans have to create longer automated test cases with more number of questions for the student bots to pass, including even the wrong and the right scenarios so that it gets prepared for the worst cases too. Since longer tests ensures better bots.
As there is not a single bot or some ten or twenty questions but millions of bots and zillions of questions so how does the test, build, test cycle repeat? In that case you have to automate the process and keep on testing the same.
When a final bot is built it works and it is the only one which survives among the all as it is the only one whose algorithm was 0.01% better than the other bot. The algorithm that the student bot has built is not known by the teacher bot, not by the human overseer and not by even the student bot itself! It. Just. Works!
How the bot thinks or works, what it thinks is not really knowable.
Let’s come back to the YouTube example that we have discussed. We can understand this better now. The task here given to the student bots is to record the watch time of a user while keeping engaged and the student bot who keeps the user engaged for the longest watch time will score the highest. The teacher bots assess all the student bots and the student bots keep on giving recommendations to the users so that the user remain engaged. The one who gives the best recommendations and keep the user engaged is the one with the best algorithm.
We’ve seen that the teacher bot is just testing the student bots and they are learning from the tests. So, in one line we can say that Machine learning is teachable if it is testable.
Written by Deeksha Agarwal
Deeksha Agarwal is in Product Growth at LambdaTest and is also a passionate tech blogger and product evangelist.
1154 Views | 13 Min Min Read
11837 Views | 6 Min Min Read
20471 Views | 12 Min Min Read
21895 Views | 12 Min Min Read