Master LLMs with our FREE course in collaboration with Activeloop & Intel Disruptor Initiative. Join now!

Publication

A quick introduction to Machine Learning. Part-1
Latest   Machine Learning

A quick introduction to Machine Learning. Part-1

Last Updated on July 25, 2023 by Editorial Team

Author(s): Abhijith S Babu

Originally published on Towards AI.

Machine learning is a term that is very popular at least for tech enthusiasts. Machine learning is a significant component of Artificial Intelligence, the buzzword of the current era. This article intends to give you a quick and in-depth introduction to Machine Learning practices…

Photo by Markus Winkler on Unsplash

When computers and other machines work intelligently like humans, we call it artificial intelligence. But what exactly is intelligence. We consider humans intelligent organisms because they have the ability to make decisions and do actions according to the dynamic environment. Suppose you go to your friend’s house and see their new pet dog. You will say “What a cute dog”. But how did you know it is a dog? It is because you have seen dogs before and you know what a dog looks like. Suppose your friend has bought a Havanese breed dog and you haven’t seen a Havanese dog yet. Then how did you identify it as a dog? Well, that is because you have seen other varieties of dogs over your lifetime and you know the features of a dog. And the animal you saw had the same features so you identified it as a dog. If you can do it, machines can learn from previous data in the same way and identify objects, make inferences, and so on. That is machine learning.

Photo by Anusha Barwa on Unsplash

Machine learning is actually used to perform tasks that are difficult for human beings to do in their head. Like a human being, machine learning is also not 100% accurate, but it can overcome the limitations of humans and give a much better output. The first concern in machine learning is the task that has to be performed. There are different types of tasks in machine learning

Supervised learning — In this type, the machine has to learn something from well-defined data. The inputs and outputs of the data that was used to learn are available for the machine. Consider the scenario where you have 1000 labeled pictures, 500 of them are cats and 500 of them are dogs. After learning these pictures, if you are given a new picture of a cat or a dog, you will be able to identify which animal is it. Or take another scenario where the price of land depends on the distance from the city center. You are given 100 plots with their distance from the city center and their price per sq. meter. You can learn from this data to predict the price of land when a new distance is given. All of these come under supervised learning

Unsupervised learning — In unsupervised learning, you don’t know the outcome of previous data. Take the case of cat and dog images discussed above. If the images are not labeled cat and dog, you won’t be able to learn which is a cat and which is a dog. Instead, you can learn the features in the images and find that there are two types of images in the set of 1000. Then you can divide the set of photos into 2 sets of approximately 500 photos each, one set contains mostly cats while the other set contains mostly dogs. This is unsupervised learning. This is mainly used in classification problems.

Reinforcement learning — Reinforcement learning is a method in which machine learns from their experience in previous actions. Consider a small kid who has very little knowledge about what he is supposed to do and what he is not supposed to do. Whenever he does something good, his parents reward him with chocolate or something else he likes, and whenever he does something bad, his parents give him small punishments. By continuously doing so, the kid might learn what to do and what not to do. The same thing applies to machine learning. Suppose you are making a chess-solving AI, the machine learns to play chess by playing it a lot of times, maybe a million times, where each of the moves it does has its reward or consequences (winning or losing the match). From repeatedly trying various moves, the machine can understand what is a good move and what is a bad move. This is how reinforcement learning works.

The above discussed are the main tasks in machine learning. There are several other tasks such as de-noising data (finding mistakes in a set of data by learning the usual pattern in data), anomaly detection, translation, and so on.

Photo by Arseny Togulev on Unsplash

Supervised Learning
First, let us have a basic idea of how supervised learning works. For supervised learning, we need a large collection of data, called a dataset. A dataset contains a huge number of data points. Each data point contains one or more input variables and a target variable. In the cat and dog photo example, we have a dataset of 1000 photos. Each photo is a data point, which consists of the image as the input variable and the label as the target variable. Now we have to find a relationship between the image and the label.

The dataset will be divided into a training dataset and a testing dataset. We use the training dataset to learn the relationship between inputs and outputs and the testing dataset to test the relationship we got. For training, we define a random relationship and try it with each data point in the training set. When the output is not matching with the target variable, we will change the relationship accordingly. This process will continue for a large number of iterations until we get good accuracy. Then we can test it with the testing dataset to find out how accurate the relationship is.

If the accuracy on the testing dataset is lower than expected, that might be because of one of the following reasons — underfitting or overfitting.
Underfitting is a situation in which the features of the training dataset inputs are not properly learned. This might be due to doing the training less than enough times. Overfitting on the other hand is a situation in which the machine learned the training data too well and it couldn’t understand the other varieties of data. It can be caused due to various reasons such as choosing the wrong training algorithm, doing more than enough iterations in the training phase, or due to poor division of training and testing datasets.

Division of datasets into training and testing datasets is very important. Suppose your dataset contains 500 photos each of cats, dogs, and rabbits, if you divide the dataset such that the training dataset contains only rabbits, then the testing phase will not give a good result. There are many things to consider while dividing the data, choosing the number of iterations as well as choosing the correct algorithm.

That’s all for part-1. In part-2, I will explain how the supervised learning algorithms actually work. Follow me to get the upcoming parts. Give your doubts and suggestions in the response and they will be considered in the upcoming parts. Happy reading!!!

Photo by Possessed Photography on Unsplash

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓