Mashinali o‘qitishga kirish Nosirov Xabibullo xikmatullo o‘gli Falsafa doktori (PhD), tret kafedrasi mudiri


Clustering Fisher's Iris Data Using K-Means Clustering


Download 1.6 Mb.
bet3/10
Sana15.06.2023
Hajmi1.6 Mb.
#1478310
1   2   3   4   5   6   7   8   9   10
Bog'liq
Mashinali o\'qitishga kirish 20-ma\'ruza Nosirov Kh

Clustering Fisher's Iris Data Using K-Means Clustering

The function kmeans performs K-Means clustering, using an iterative algorithm that assigns objects to clusters so that the sum of distances from each object to its cluster centroid, over all clusters, is a minimum. Used on Fisher's iris data, it will find the natural groupings among iris specimens, based on their sepal and petal measurements. With K-means clustering, you must specify the number of clusters that you want to create.

First, load the data and call kmeans with the desired number of clusters set to 2, and using squared Euclidean distance. To get an idea of how well-separated the resulting clusters are, you can make a silhouette plot. The silhouette plot displays a measure of how close each point in one cluster is to points in the neighboring clusters

Clustering Fisher's Iris Data Using K-Means Clustering

load fisheriris

[cidx2,cmeans2] = kmeans(meas,2,'dist','sqeuclidean');

[silh2,h] = silhouette(meas,cidx2,'sqeuclidean');

Clustering Fisher's Iris Data Using K-Means Clustering

From the silhouette plot, you can see that most points in both clusters have a large silhouette value, greater than 0.8, indicating that those points are well-separated from neighboring clusters. However, each cluster also contains a few points with low silhouette values, indicating that they are nearby to points from other clusters.

It turns out that the fourth measurement in these data, the petal width, is highly correlated with the third measurement, the petal length, and so a 3-D plot of the first three measurements gives a good representation of the data, without resorting to four dimensions. If you plot the data, using different symbols for each cluster created by kmeans, you can identify the points with small silhouette values as those points that are close to points from other clusters.

Clustering Fisher's Iris Data Using K-Means Clustering


Download 1.6 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling