# 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](https://jgoodman8.gitbook.io/iron-data-science-notebook/ml-datascience/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](https://jgoodman8.gitbook.io/iron-data-science-notebook/ml-datascience/machine-learning-algorithms/unsupervised-learning/clustering/kmeans)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jgoodman8.gitbook.io/iron-data-science-notebook/ml-datascience/frequent-questions/supervised-vs-unsupervised-learning.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
