![](https://crypto4nerd.com/wp-content/uploads/2023/05/1dmbNkD5D-u45r44go_cf0g.png)
In machine learning, there are two broad classes of learning: supervised and unsupervised learning. In supervised learning, we know what the correct output is for certain input data. The goal then is to train the algorithm to learn to predict the correct output for future inputs. In unsupervised learning, our data is unlabeled. That means we don’t know what the correct output should be. Instead, the algorithm tries to find patterns in the data on its own. Each of these two classes of learning can accomplish different tasks. From predicting prices of houses to grouping similar daily news articles, there is a great deal that machine learning can do with the right understanding of which algorithms to apply.
Unsupervised learning
The key point of unsupervised learning is that the algorithm analyzes unlabeled data.
Two types of unsupervised learning often used include clustering and anomaly detection.
Clustering seeks to group an unlabeled dataset into different clusters, based on similarities. It is implemented with the k-means algorithm. A common use case for clustering is customer segmentation; by grouping similar customers together, companies can serve better product recommendations for their users.
Anomaly detection trains a machine to identify irregular observations in data. For example, given a large dataset of emails (consisting of both spam and non-spam), an anomaly detection algorithm can detect which emails are likely to be spam. The anomaly detection algorithm outputs a probability for each example, telling us if it is likely to be spam or not. We then apply a value called epsilon, a threshold or dividing line for labeling which are spam and which aren’t.
Supervised learning
The key idea of supervised learning is that pairs of input / output values are used to train the model, upon which the model can then be used to map future examples when we don’t know the correct output yet.
Two types of supervised learning often used include regression and classification.
Regression predicts a value along a continuous set of possible values. For example, predicting the price of houses is implemented with regression. Regression need not be linear — we can fit a nonlinear function, such as a polynomial function, to the data if the relationship between input and output does not fit a straight line.
Classification, which is also called logistic regression, predicts results in a discrete output. It uses the sigmoid activation function, which outputs values in the interval (0,1), which we can interpret as a probability.
Both regression and classification algorithms can be used to implement neural networks, a deep learning algorithm that was inspired and loosely models how neurons in the human brain work.
Reinforcement learning
Reinforcement learning is neither a supervised nor unsupervised learning algorithm. In reinforcement learning, an agent learns decision-making by actively engaging with its environment. The agent maximizes its overall reward over time by choosing actions that lead to positive rewards and avoiding those with negative rewards. Through a trial-and-error process, the agent refines its strategy and improve its performance over time.
Key Ideas in ML
Train / validation / test set is a technique used to divide your data into three subsets. The train set is used to train the model and have the model tune its parameters to fit the train set well. The validation set is used for tuning the model’s hyper-parameters, which are parameters that broadly define how the model works (such as how large it is or the learning rate used in back-propagation). Lastly, the test set is the final evaluation on the completed model, providing information on how well it will perform on future data.
Bias and variance are terms used to describe how well the model fits to the data. High bias means that the model did not fit the data well enough, resulting in a gap between the model’s predictions and the ground truth label (underfitting). High variance means that the model overrepresented the training data and did not generalize well enough to new unseen data (overfitting).