"- Comment the choice of Kmeans input parameters used above\n",

"- 'The elbow method' from the above graph : find the optimum number of clusters by observing the within cluster sum of squares (WCSS). Explain the shape of the curve WCSS=f(nb of clusters)\n",

"- What is the asymptotic value of WCSS when the. umber of clusters approaches N (nb of points)? \n",

...

...

@@ -133,7 +133,7 @@

"cell_type": "markdown",

"metadata": {},

"source": [

"## Exercize\n",

"## Exercize 4\n",

"- remind the reasons why the clusters formed by KMeans algorithm are are included in Voronoï cells associated to the centroïds\n",

"- Comment the shape of the obtained clusters represented in the figure above\n",

"- How would you check that enough iterations were performed? "

...

...

@@ -183,7 +183,7 @@

"cell_type": "markdown",

"metadata": {},

"source": [

"## Exercize\n",

"## Exercize 5\n",

"- Propose a measure of the goodness of clustering, associated to this problem (implementation is not required).\n",

"- How could the cost-complexity tradeoff be tackled? "

]

...

...

@@ -212,7 +212,7 @@

"name": "python",

"nbconvert_exporter": "python",

"pygments_lexer": "ipython3",

"version": "3.8.3"

"version": "3.8.2"

}

},

"nbformat": 4,

...

...

%% Cell type:markdown id: tags:

This notebook can be run on mybinder: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fgricad-gitlab.univ-grenoble-alpes.fr%2Fchatelaf%2Fml-sicom3a/master?urlpath=lab/tree/notebooks/7_Clusturing/N2_Kmeans_iris_data_example/)

#Plotting the results onto a line graph, allowing us to observe 'The elbow'

plt.plot(range(1,11),wcss)

plt.title('The elbow method')

plt.xlabel('Number of clusters')

plt.ylabel('WCSS')#within cluster sum of squares

plt.show()

```

%% Output

%% Cell type:markdown id: tags:

## Exercize

## Exercize 3

- Comment the choice of Kmeans input parameters used above

- 'The elbow method' from the above graph : find the optimum number of clusters by observing the within cluster sum of squares (WCSS). Explain the shape of the curve WCSS=f(nb of clusters)

- What is the asymptotic value of WCSS when the. umber of clusters approaches N (nb of points)?

- Explain why the curve doesn't decrease significantly with every iteration

%% Cell type:code id: tags:

``` python

#Applying kmeans to the dataset / Creating the kmeans classifier