This article demonstrates an illustration of K-means clustering on a sample random data using open-cv library.
Here ‘Z’ is an array of size 100, and values ranging from 0 to 255. Now, reshaped ‘z’ to a column vector. It will be more useful when more than one features are present. Then change the data to np.float32 type.
Now, apply the k-Means clustering algorithm to the same example as in the above test data and see its behavior.
1) First we need to set a test data.
2) Define criteria and apply kmeans().
3) Now separate the data.
4) Finally Plot the data.
This example is meant to illustrate where k-means will produce intuitively possible clusters.
1) Identifying Cancerous Data.
2) Prediction of Students’ Academic Performance.
3) Drug Activity Prediction.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Elbow Method for optimal value of k in KMeans
- DBSCAN Clustering in ML | Density based clustering
- ML | Hierarchical clustering (Agglomerative and Divisive clustering)
- Difference between CURE Clustering and DBSCAN Clustering
- Python | Clustering, Connectivity and other Graph properties using Networkx
- Image compression using K-means clustering
- Implementing Agglomerative Clustering using Sklearn
- ML | OPTICS Clustering Implementing using Sklearn
- Image Segmentation using K Means Clustering
- Data analysis using Pandas
- Data analysis and Visualization with Python
- Replacing strings with numbers in Python for Data Analysis
- Data Analysis and Visualization with Python | Set 2
- Exploratory Data Analysis in Python
- Python | Math operations for Data analysis
- Multidimensional data analysis in Python
- Exploratory Data Analysis in Python | Set 1
- Exploratory Data Analysis in Python | Set 2
- Clustering in R Programming
- Clustering in Machine Learning
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.