# Supervised vs Unsupervised learning

{% hint style="info" %}
&#x20;_More reading:_ [_What is the difference between supervised and unsupervised machine learning? (Quora)_](https://www.quora.com/What-is-the-difference-between-supervised-and-unsupervised-learning-algorithms)
{% endhint %}

## Supervised learning

* It requires **labeled data** for training.&#x20;
* Tasks are mainly focused on **getting a&#x20;**_**solution**_**&#x20;or&#x20;**_**prediction**_ expressed as a:
  * Classification
  * Regression

## Unsupervised learning

* It does **not require labeled data** due to it does not perform training.
* Tasks are mainly focused on **getting&#x20;**_**insights**_**&#x20;or&#x20;**_**guesses**_ through:
  * Clustering
  * Visualization
  * Dimensionality reduction
  * Asociation mining

## An example: KNN vs kMeans

{% hint style="info" %}
&#x20;_More reading:_

* [_How is the k-nearest neighbor algorithm different from k-means clustering? (Quora)_](https://www.quora.com/How-is-the-k-nearest-neighbor-algorithm-different-from-k-means-clustering)
{% endhint %}

### K-Nearest Neighbors

* Supervised algorithm
* Based on **how similar is an instance from its k neighbors**
* There is no training
* It measures the distance between instances (Euclidian, Manhattan...)

{% content-ref url="../machine-learning-algorithms/supervised-learning/classification-algorithms/knn" %}
[knn](../machine-learning-algorithms/supervised-learning/classification-algorithms/knn)
{% endcontent-ref %}

### kMeans

* Unsupervised algorithm
* Clustering algorithm
* Iteratively assigns data to k groups

{% content-ref url="../machine-learning-algorithms/unsupervised-learning/clustering/kmeans" %}
[kmeans](../machine-learning-algorithms/unsupervised-learning/clustering/kmeans)
{% endcontent-ref %}

