Now everyone using AI in all apps, regardless of whether it requires or not, one thing is sure, AI is a big change in software industry. As a software engineer, I felt the need to keep up. I need to understand AI before using it; otherwise, it seems like magic to me. I need to start from scratch.
I'm starting from scratch and documenting my journey. If I can explain what I've learned, it means I've understood it. This is the first blog post, with more to come as I keep learning.
Machine Learning
A machine processes numbers. Whatever input you provide to a computer, it converts it into numbers, performs operations, and returns the output.
If you need to add two numbers, you will provide these two numbers as input. There will be a function to calculate the sum of the input numbers. Once the calculation is complete, you will receive the output. In this example, the function performs the calculation. In machine learning terms, a machine learning model is an application that encapsulates this function. The process of defining the function is training.
Types of Machine Learning
1. Supervised Machine Learning
In supervised machine learning, training involves both input and output data. By understanding the relationship between them, we can predict outputs from new datasets.
For example, consider a system designed to predict house prices. In supervised machine learning, we start with a dataset containing features such as the size of the house, the number of bedrooms, the age of the house, and the price it was sold for. By analyzing this dataset, the model learns the relationship between these features and the house prices. When we provide new data, like the size and age of another house with no price information, the model can predict the expected price based on the learned relationships.
1.1 Regression
Regression models forecast the output using known labels. This involves identifying an algorithm that is appropriate for the model.
For instance, let’s consider predicting the price of a car based on its age. Suppose we have a dataset with the following information: the ages of various cars and their corresponding prices.
Age of Car (years) | Price ($) |
---|---|
1 | 30,000 |
2 | 27,000 |
3 | 24,000 |
4 | 21,000 |
5 | 18,000 |
Here, the age of the car is the input feature, and the price is the known label. The regression model will analyze this dataset and learn the relationship between the car's age and its price. Once the model is trained, we can use it to predict the price of a car given its age.
For example, if we want to determine the price of a car that is 6 years old, we input the age (6 years) into the trained model, and it will predict the output price based on the learned relationship. Let’s say the model predicts the price to be $15,000. Thus, the regression model helps in forecasting the output (price) using the known labels (prices of cars of different ages).
This process highlights how regression models can be used to make predictions when we have a dataset with known labels and want to forecast outcomes for new data points.
1.2 Classification
Classification is like regression, the process is same, instead of predicting value we classify the value.
1.2.1 Binary Classification
In binary classification, the modal is trained to predict true or false values. Take real life example of classifying, diabetic patient based on blood glucose. To train the modal like regression we need data
Blood glucose (x) Diabetic? (y)
Blood Glucose | Diabetic |
---|---|
67 | 0 |
103 | 1 |
114 | 1 |
72 | 0 |
116 | 0 |
Next is to find a suitable algorithm for our use case such as logistic regression, then the process is same as regression.
1.2.2 Multiclass classification
This is like binary classification, but instead of predicting true or false, it predicts multiple labels.
One common example of multiclass classification is the prediction of Body Mass Index (BMI) categories. Instead of predicting whether an individual is overweight or not (binary classification), the model predicts one of three possible labels: underweight, normal weight, or overweight. This type of classification can be achieved using algorithms such as One-vs-Rest (OvR) algorithms or Multinomial algorithms where the process involves fitting a model to predict the likelihood of each category based on input features like height and weight.
2. Unsupervised Machine Learning
In contrast to supervised learning, unsupervised learning does not involve labels during model training, meaning it does not use previously known labels.
2.1 Clustering
Clustering is a type of unsupervised machine learning that involves grouping similar data points together based on their features. There are no predefined labels to guide the training process. Instead, the algorithm identifies the inherent structure in the data to form clusters.
For example, consider a dataset containing various car models. We want to group these cars into different categories such as SUVs, sedans, hatchbacks, etc. Using a clustering algorithm like K-means, we can achieve this by analyzing features such as the size of the car, engine power, seating capacity, and price range.
The algorithm will process the input data and partition it into clusters based on the similarities in these features. SUVs might cluster together due to their larger size and higher seating capacity, while sedans and hatchbacks form their own distinct groups based on their attributes. The result is a set of clusters where cars within the same cluster are more like each other than to those in other clusters.
This kind of clustering helps in various applications, such as market segmentation, inventory management, and recommendation systems, by understanding and leveraging the natural grouping within the data.
Conclusion
In essence, machine learning encompasses methods for making predictions based on data. Supervised learning involves labelled data to predict outcomes, while unsupervised learning identifies patterns and groups similar data points without predefined labels. Both types offer valuable insights and applications across various domains.
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.