# Supervised Learning

In **supervised learning**, every training sample from the dataset has a corresponding label or output value associated with it. As a result, the algorithm learns to predict labels or output values.

> A **label** refers to data that already contains the solution.

#### Types of Supervised Learning <a href="#types" id="types"></a>

| Classification                                                                                  | Regression                                                                                    |
| ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| Classification tasks involve predicting some unknown **categorical** attribute about your data. | Regression tasks involve predicting some unknown **continuous** attribute about your data.​   |
| <ul><li>Naive Bayes</li><li>K-Nearest Neighbour</li></ul>                                       | <ul><li>Linear Regression</li><li>Logistic Regression</li><li>Polynomial Regression</li></ul> |

## Classification <a href="#classification" id="classification"></a>

* _Classification_ is a form of machine learning that is used to predict which category, or _class_, an item belongs to.&#x20;
* For example, a health clinic might use the characteristics of a patient (such as age, weight, blood pressure, and so on) to predict whether the patient is at risk of diabetes. In this case, the characteristics of the patient are the features, and the label is a classification of either **0** or **1**, representing non-diabetic or diabetic.
* Classification is an example of a _supervised_ machine learning technique in which you train a model using data that includes both the features and known values for the label, so that the model learns to _fit_ the feature combinations to the label. Then, after training has been completed, you can use the trained model to predict labels for new items for which the label is unknown.

## Regression <a href="#regression" id="regression"></a>

* _Regression_ is a form of machine learning that is used to predict a numeric _label_ based on an item's _features_.
* For example, an automobile sales company might use the characteristics of a car (such as engine size, number of seats, mileage, and so on) to predict its likely selling price. In this case, the characteristics of the car are the features, and the selling price is the label.​
*   Regression is an example of a _supervised_ machine learning technique in which you train a model using data that includes both the features and known values for the label, so that the model learns to _fit_ the feature combinations to the label. Then, after training has been completed, you can use the trained model to predict labels for new items for which the label is unknown.





* has a feedback mechanism.
* Used In
  * Risk Assessment
  * Image Classification
  * Fraud Detection
  * Visual Recognition

Evaluate Model

* **Mean Absolute Error (MAE)**: The average difference between predicted values and true values. This value is based on the same units as the label, in this case dollars. The lower this value is, the better the model is predicting.
* **Root Mean Squared Error (RMSE)**: The square root of the mean squared difference between predicted and true values. The result is a metric based on the same unit as the label (dollars). When compared to the MAE (above), a larger difference indicates greater variance in the individual errors (for example, with some errors being very small, while others are large).
* **Relative Squared Error (RSE)**: A relative metric between 0 and 1 based on the square of the differences between predicted and true values. The closer to 0 this metric is, the better the model is performing. Because this metric is relative, it can be used to compare models where the labels are in different units.
* **Relative Absolute Error (RAE)**: A relative metric between 0 and 1 based on the absolute differences between predicted and true values. The closer to 0 this metric is, the better the model is performing. Like RSE, this metric can be used to compare models where the labels are in different units.
* **Coefficient of Determination (R2)**: This metric is more commonly referred to as _R-Squared_, and summarizes how much of the variance between predicted and true values is explained by the model. The closer to 1 this value is, the better the model is performing.

{% embed url="https://serokell.io/blog/naive-bayes-classifiers" %}
