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

"- 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",

"- '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",

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

...

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

...

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

"cell_type": "markdown",

"cell_type": "markdown",

"metadata": {},

"metadata": {},

"source": [

"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",

"- 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",

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

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

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

...

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

...

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

"cell_type": "markdown",

"cell_type": "markdown",

"metadata": {},

"metadata": {},

"source": [

"source": [

"## Exercize\n",

"## Exercize 5\n",

"- Propose a measure of the goodness of clustering, associated to this problem (implementation is not required).\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? "

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

]

]

...

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

...

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

"name": "python",

"name": "python",

"nbconvert_exporter": "python",

"nbconvert_exporter": "python",

"pygments_lexer": "ipython3",

"pygments_lexer": "ipython3",

"version": "3.8.3"

"version": "3.8.2"

}

}

},

},

"nbformat": 4,

"nbformat": 4,

...

...

%% Cell type:markdown id: tags:

%% 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/)

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'

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

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

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

plt.title('The elbow method')

plt.title('The elbow method')

plt.xlabel('Number of clusters')

plt.xlabel('Number of clusters')

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

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

plt.show()

plt.show()

```

```

%% Output

%% Output

%% Cell type:markdown id: tags:

%% Cell type:markdown id: tags:

## Exercize

## Exercize 3

- Comment the choice of Kmeans input parameters used above

- 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)

- '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)?

- 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

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

%% Cell type:code id: tags:

%% Cell type:code id: tags:

``` python

``` python

#Applying kmeans to the dataset / Creating the kmeans classifier

#Applying kmeans to the dataset / Creating the kmeans classifier