Machine Learning
Machine learning is a subfield of artificial intelligence, which focuses on the use of data and algorithms to imitate the way that humans learn.
How Does Machine Learning Work?
Machine learning algorithms analyze and identify patterns from datasets and use this information to make better predictions on new data sets.
It’s similar to how the human brain gains knowledge and understanding. Whenever we make a decision, we consider our past experiences to assess the situation better. A machine learning model does the same by analyzing historical data to make predictions or decisions. So it is provides machines to self-learn from data.
For example, we can predict the price of a house given its features with machine learning, or we can calculate the probability of survival of people of a certain age-sex-class in the titanic dataset.
Learning Types
1. Supervised Learning
Supervised learning uses labeled input and output data. So in supervised learning, the algorithm “learns” from the training dataset.
2. Unsupervised Learning
Unsupervised learning uses machine learning algorithms to analyze and cluster unlabeled data sets. It studies how systems can infer a function to describe a hidden structure from unlabeled data.
3.Reinforcement Learning
Reinforcement learning is a type of machine learning method where an intelligent agent interacts with the environment and learns to act within that.
Problem Types
- Regression Problems: When the need is to predict numerical values, such kinds of problems are called regression problems. For example, house price prediction.
- Classification Problems: When there is a need to classify the data in different classes, it is called a classification problem. For example, classify whether a person is suffering from a disease or otherwise.
Model Success Evaluation Methods
1. Regression Models
There are 3 main metrics for model evaluation in regression:
- Mean Square Error(MSE)
- Root Mean Square Error(RMSE)
- Mean Absolute Error(MAE)
2. Classification Models
Confusion matrix:
It is a matrix used to determine the performance of the classification models for a given set of test data.
True Positive (TP): A true positive is an outcome where the model correctly predicts the positive class.
True Negative (TN): A true negative is an outcome where the model correctly predicts the negative class.
False Positive (FP): A false positive is an outcome where the model incorrectly predicts the positive class.
Get Lale Demir’s stories in your inbox
Join Medium for free to get updates from this writer.
False Negative (FN): A false negative is an outcome where the model incorrectly predicts the negative class.
Accuracy:
It’s the number of correctly predicted data points out of all the data points.
(TP+TN) / (TP+TN+FP+FN)
Precision:
It’s the ratio between the True Positives and all the Positives.
TP / (TP+FP)
Recall:
It’s the number of true positive instances to the total number of instances actually belong to positive class.
TP / (TP+FN)
F1 score:
It’s the harmonic mean of precision and recall
F1 Score = 2 * (precision * recall) / (precision + recall)
ROC (Receiver Operating Characteristics) Curve:
It’s a graph showing the performance of a classification model at all classification thresholds. This curve plots two parameters:
True Positive Rate and False Positive Rate
It is a probability curve that plots the TPR against FPR at various threshold values and essentially separates the ‘signal’ from the ‘noise’. The Area Under the Curve (AUC) is the measure of the ability of a classifier to distinguish between classes and is used as a summary of the ROC curve.
Model Validation
Model validation is the set of processes and activities intended to verify that models are performing as expected.
Model Validation Techniques
1. Holdout Method
The most basic method for evaluating a classifier. In this method, the data set is separated into two sets, called the Training set and Test set. The training data is used to induce the model and validation data is evaluates the performance of the model.
2. K-fold Cross-Validation Method
In k-fold cross-validation, the original dataset is equally broken into k number of folds. Out of the k-folds, for each iteration, one group is selected as validation data, and the remaining (k-1) groups are selected as training data.
The process is repeated for k times until each group is treated as validation and remaining as training data. The average of the results will be used as the final result.
Bias-Variance Tradeoff
Overfitting: Good performance on the training data, poor generliazation to other data.
Underfitting: Poor performance on the training data and poor generalization to other data.
References
https://www.ibm.com/cloud/blog/supervised-vs-unsupervised-learning








