# k-mean clustering and its real usecase in the security domain

In this article you are going to known about what is k-mean clustering , where you can use it and it’s industry usecase in security domain.

When trying to analyze data, one approach might be to look for meaningful groups or clusters. Clustering is dividing data into groups based on similarity. And K-means is one of the most commonly used methods in clustering. It is because it’s simplicity.

## How does k-mean clustering works?

Let’s say we’d like to divide the following points into clusters.

step1:choose k value for ex: k=2

step2:initialize centroids randomly

step3:calculate Euclidean distance from centroids to each data point and form clusters that are close to centroids

step4: find the centroid of each cluster and update centroids

step:5 repeat step3

Each time clusters are made centroids are updated, the updated centroid is the center of all points which fall in the cluster. This process continues till the centroid no longer changes i.e solution converges.

## How To Choose K Value In K-Means:

1.Elbow method

steps:

step1: compute clustering algorithm for different values of k.

for example k=[1,2,3,4,5,6,7,8,9,10]

step2: for each k calculate the within-cluster sum of squares(WCSS).

step3: plot curve of WCSS according to the number of clusters.

step4: The location of bend in the plot is generally considered an indicator of the approximate number of clusters.

We can also use this concepts of kmeans clustering in cyber security .for example

*Customer Profiling**Market segmentation**Computer vision**Geo-statistics**Astronomy**Document clustering**Identifying crime-prone areas**Cluster analysis**Feature learning or dictionary learning**Identifying crime-prone areas*

Thank you for reading this article!!!!!!!