> For the complete documentation index, see [llms.txt](https://jgoodman8.gitbook.io/iron-data-science-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jgoodman8.gitbook.io/iron-data-science-notebook/ml-datascience/frequent-questions/supervised-vs-unsupervised-learning.md).

# 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="/pages/-LrAIewsDiCT3jqH32hT" %}
[kNN](/iron-data-science-notebook/ml-datascience/machine-learning-algorithms/supervised-learning/classification-algorithms/knn.md)
{% endcontent-ref %}

### kMeans

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

{% content-ref url="/pages/-LrAIr3kElc-\_RG5edB0" %}
[kMeans](/iron-data-science-notebook/ml-datascience/machine-learning-algorithms/unsupervised-learning/clustering/kmeans.md)
{% endcontent-ref %}
