What is machine learning?
We all come to hear about this weird thing, whether it is the field of physics, mathematics or biology and it always makes us think what does it mean?
On a layman perspective, if I want to explain machine learning to you I would break down the two words and try to get an insight on each of them separately. So let’s get started.
Machines are the devices that make our life easier, by implementing some laborious task, but they all are hardcoded, what I mean by hardcoded is their actions are predetermined. Let’s take an example of television, it’s task is to provide you with entertainment. You could watch movies, listen to pieces of music and play your favorite video games.
Now you might be wondering okay, you told us television is a machine what’s a great deal about it, everyone knows about it. What if a television is able to recommend you some movies that you actually find interesting, what if it plays a music that you find mesmerizing, what if it suggests you a video game that you haven’t heard of and you like it a lot. I mean that’s entertaining right, instead of searching through movies on our own if someone already knew what kind of movies do we like or what kind of music do we like to listen or what kind of games do we like to play, then I think the title of entertainment will be rightly suited to that machine, right?
Well, that sounds interesting, How to do that latter part then? Well, your wait is over, that is what machine learning does. If you want to get a formal definition it is a field in which a computer tries to learn or we can say tries to find a pattern from the data without being explicitly programmed.
Let me give an example to make it more clear to you. Say you created a chatbot. There are two ways to do so. Let me describe the first part, In this, you tried to hard code it. You filled your code with a bunch of “if” “else” statements i.e. if a user type “hello”, my chatbot will also reply “hello”. If the user typed “How are you?” my chatbot will reply “fine”. and so on you build thousands of conditions. Finally, you completed your chatbot. You asked a friend of yours to test the chatbot. Your friend asked, “What is the meaning of life and what is the purpose of it?”. and… your chatbot crashed, well even a human will crash on this question :|. So you see you cannot fit every question and answer pair with if else statements you will eventually run out of some questions that were left unanswered right?. So what do we do now? Well, Let me present you a very interesting technique that is ready to be served on your tables and it is, of course, Machine Learning!
# Hard code way...
user_input = str(input())
if user_input == 'hello':
print('hello, kishan')
elif user_input == 'i like you':
print('i like you too')
elif user_input == 'how are you?':
print('i am fine, how about you?')
elif user_input == 'bye':
print('sayonara')
# and the statement goes on forever
So let’s go machine learning way and explain how to make a chatbot using its way. Your task is simple you only need to get a dataset, in this scenario we will be requiring a lot of conversation between two peoples. for e.g., if you want to create a virtual girlfriend or boyfriend, I am sorry I cannot come up with a good example but you know I created a virtual girlfriend chatbot, that is why I thought you might also find it interesting :). To create a virtual girlfriend you need a lot of conversation examples between you and your girlfriend and then you need to feed that to your model, and after hours of learning, it will get an essence of what to say when you ask a certain question. So in this technique, we didn’t have to go through a bunch of if and else statements. All our hard work was done by the machine itself we didn’t have to explicitly program it, it learned on its own.
#conversation.txt
#this file will be your dataset, it will contain all the #converations between you and your girlfriend, if you don't have, #use google, you don't have to make a girfriend to create a chatbot, #...duhAlena: "Hi"
You: "Hi"
Alena: "Where are you?"
You: "I am at my home"
Alena: "So who is in the bar?"
# You get the point, right?
This was just a trailer of what a machine learning do, let me give you more examples of it. You can do the following:
- Train a model to predict housing prices in your area based on certain features like the area of the house, the location in which it is situated, number of the bedroom it has.
- Train a model to recognize digits, yes you heard it right, cool isn’t it.
- Train a model to recognize human or what we call a pedestrian detector, it is more focused in the domain of deep learning which is a subset of machine learning.
- You can create a self-driving car using machine learning and computer vision combined.
… and the list goes on. I Hope you got the gist of machine learning. Let me know if you have any doubt in the comment section.