SlideShare a Scribd company logo
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013

An Improvement in K-mean Clustering Algorithm
Using Better Time and Accuracy
Er. Nikhil Chaturvedi1 and Er. Anand Rajavat2
1

Dept.of C.S.E, S.V.I.T.S, Indore (M.P)and 2 Asst. Prof, S.V.I.T.S, Indore

Abstract:
Cluster analysis or clustering is the task of grouping a set of objects in such a way that objects in the same
group (called a cluster) are more similar (in some sense or another) to each other than to those in other
groups (clusters).K-means is one of the simplest unsupervised learning algorithms that solve the well
known clustering problem. The process of k means algorithm data is partitioned into K clusters and the
data are randomly choose to the clusters resulting in clusters that have the same number of data set. This
paper is proposed a new K means clustering algorithm we calculate the initial centroids systemically
instead of random assigned due to which accuracy and time improved.

Key words: Data mining, Cluster, Basic K-means algorithm, Improved K-means algorithm.

I INTRODUCTION
data mining refers to using a variety of techniques it identify suggests of information or decision making knowledge in the database and extracting these in such a way they can use different area
such as decision support forecasting. The data is often voluminous. It is the hidden information in
the data that is useful. Data mining depends on effective data collection and warehousing as well
as computer processing. Data mining involves the use of sophisticated data analysis tools to
discover previously unknown, valid pattern and relationship in large data set [1].
Clustering is one of the tasks of data mining. Clustering [2] is useful technique for the discovery
of data distribution and patterns in the underlying data. The aim of clustering is to discover both
dense and sparse regions in data set. The main two approaches to clustering - hierarchical
clustering and partitioning clustering [3] K-mean algorithm is main categories of partitioning
algorithm. The main difference between partitioned and hierarchical clustering is that, in
partitioned clustering algorithm data is partitioned into more than two subgroups in hierarchical
clustering algorithm data is divided into two subgroups in each step. K-mean clustering is a
partitioning clustering technique in which clusters are formed with the help of centroids. On the
basis of these centroids, clusters can vary from one another in different iterations. Moreover, data
elements can vary from one cluster to another, as clusters are based on the random numbers
known as initial centroids.
A new algorithm is introduced and implemented in research. The whole paper is organized in this
way. First the basic K-mean clustering algorithm is discussed and then proposed K-mean
DOI : 10.5121/ijpla.2013.3402

13
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013

clustering algorithm is explored. The implementation work and the results of experiments are
followed by the comparison of both algorithms.

II RELATED WORK
In [4] the research of k-Means clustering algorithm is one of the clustering algorithms which have
lot of used in applications because of its simplicity and implementation. K-Means algorithm’s is
less accuracy because of selection of k initial centers is randomly. Therefore, in this paper
surveyed different approaches for initial centers selection for k-Means algorithm. Comparative
analysis of Original K-Means and improved k-Means Algorithm.
In [5] this paper study of different approaches to k- Means clustering, and analysis of different
datasets using Original k-Means and other modified algorithms.
In [6] this paper main aim to reduce the initial centroid for k mean algorithm. This paper
proposed Hierarchical K-means algorithm. It uses all the clustering algorithm results of K-means
and reaches its local optimal. This algorithm is used for the complex clustering cases with large
numbers of data set and many dimensional attributes because Hierarchical algorithm in order to
determine the initial centroids for K-means.
In [7] researchers introduced K mean clustering algorithm.
This paper proposes method for the making K-means clustering algorithm more efficient and
effective. In this paper time complexity improve using the unique data set.

III BASIC K-MEAN CLUSTERING ALGORITHM
K means clustering [8] is a partition-based cluster analysis method. According to this algorithm
we firstly select k data value as initial cluster centers, then calculate the distance between each
data value and each cluster center and assign it to the closest cluster, update the averages of all
clusters, repeat this process until the criterion is not match.
K means clustering aims to partition data into k clusters in which each data value belongs to the
cluster with the nearest mean. Figure 1 shows how to process of the basic K mean clustering
algorithm [9] in steps.

Basic K-mean algorithm:
Initially, we are chose K number of clusters in algorithm.
The first step is to choose a set of K objects as centres of the clusters. Often chosen such that the
objects are in distance basis how to one or more further away.
In the next step of the algorithm considers each object and assigns it to the cluster which is
closest.
After that the cluster centroids are recalculated after each Object assignment, or after the whole
cycle are completed.
14
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013

This process is repeat until the all object are assign to its clusters.

Fig. 1 K mean Algorithm Process

IV PROPOSED ALGORITHM
In the proposed clustering method discussed in this paper, for the original k-means algorithm is
modified to improve the time and accuracy.
Input:
D is the set of all the data items
k is number of clusters
Output:
A set of k clusters.
Steps:

Phase 1: For the initial centroids
Input:
D // set of n data
k // Number of clusters
Output: A set of k initial centroids.
15
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013

Steps:
1. Set p = 1;
2. Measure the distance between each data and all other data in the set D;
3. Find the closest pair of data from the set D and form a data set Ap (1<= p <= k) which
contains these two data, Delete these two data from the set D;
4. Find the data in D that is closest to the data set Ap, Add it to Ap and delete it from D;
5. Repeat step 4 until the number of data in Ap reaches all data in D;
6. If p<k, then p = p+1, find another pair of data from D between which the distance is the small
form another data set Ap and delete them from D, Go to step 4;
7. for each data-point set Ap (1<=p<=k) find the mean of data in Ap.
These means will be the initial centroids.

Phase 2: Data to the clusters
Input:
D // set of n data.
C // set of k centroids
Output:
A set of k clusters
Steps:
1. Compute distance between each data to all the centroids
2. for each data di find the closest centroid ci and assing to cluster j.
3. Set ClusterCL[i] = j; // j:CL of the closest cluster
4. Set Shorter_Dist[i] = d (di, cj);
5. For each cluster j (1<=j<=k), recalculate the centroids;
6. Repeat
7. for each data di,
7.1 Compute the distance from the centroids of the closest cluster;
7.2 If distance is less than or equal to the present closest distance, the data-point stays in
cluster;
Else
7.2.1 For every centroids compute the distance.
End for;
7.2.2 Data di assign to the cluster with the closest centroid cj
7.2.3 Set ClusterCL[i] =j;
7.2.4 Set Shorter_Dist[i] = d (di, cj);
End for;
8. For each cluster j (1<=j<=k), recalculate the centroids; until the criteria is met.
In the first phase, we determine initial centroids systematically. The second phase use of
functions of the clustering method. It starts by the initial clusters based on the distance of each
data from the initial centroids. These clusters are finding by using a heuristic approach, thereby
improving the accuracy. In this phase compute the distance between the data and all other data
from the data set. Then find out the closest pair of data and form a set A1 consisting of these two
data, and delete them from the data set D. After that evaluate the data which is closest to the set
A1, add it to A1 and delete it from D. Repeat this process until the all the element in the set A1
completed. Then go back to the second step and form another data set A2. Repeat this till ’k’ such
16
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013

sets of data are obtained. Finally the initial centroids are obtained by averaging all the data in
each data set. The Euclidean distance is used for determining the close of each data to the cluster
centroids. The initial centroids of the clusters are used as input for the second phase, and
assigning data to appropriate clusters.
The first step in the second phase is to determine the distance between each data and the initial
centroids of all the clusters. After that the data are assigned to the clusters having the closest
centroids. This gives the results as initial grouping of the data. For each data the cluster to which
it is assigned (ClusterCL) and its distance from the centroid of the nearest cluster (Shorter_Dist)
are noted. For each cluster calculated the mean of the data values for the centroids. Until this step,
the process is similar as original k-means algorithm except that the initial centroids are computed
systematically.
At time of iteration, the data may get redistributed to different clusters. The method involves
distance between each data and the centroid of its present nearest cluster. At the time of starting
the iteration, the distance of each data from the new centroid of its present nearest cluster is
determined. If present distance is less than or equal to the previous nearest distance, that is an
indication that the data point stays in that cluster itself and there is no need to computation of
distance. This result save our time for required computing the distances to k-1 clusters centroids.
On the other hand, if the new centroid of the present closest cluster is more distance from the its
previous centroid, there is a chance for the data getting included in another nearer cluster. In that
case, it is required to computation of distance from the centroids. New nearest cluster and record
are identify for the new value of the nearest distance. The loop is repeated until no more data
cross cluster boundaries.

V EXPERIMENTAL RESULTS
We apply both the algorithms original and proposed for the different number of records. Both the
algorithms original and proposed need number of clusters as an input. In the basic K-means
clustering algorithm set of initial centroids are required. The proposed method finds initial
centroids systematically. The proposed method requires only the data and number of clusters as
inputs.
The basic K-means clustering algorithm is executed sevan times for the different data values of
initial centroids . In each experiment the time was computed and taken the average time of all
experiments. Table 1 shows the performance comparison of the Basic and proposed k-mean
clustering algorithms. The experiments results show that the proposed algorithm is producing
better results in less amounts of computational time and accuracy compared to the basic k-means
algorithm.
Table 1. Performance Comparison
No. of
Records

200

K=3

Algorithm

Run

Accuracy

Executio
n time in
sec

Basic k-mean

7

70.14

0.103

Proposed k-mean

100

No.
Of
Clust
er
K=3

1

82.66

0.083

Basic k-mean

7

70.10

0.128

17
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013
Proposed k-mean

K=2

82.11

0.098

7

70.57

0.144

1

82.31

0.122

Basic k-mean

7

70.44

0.162

1

82.34

0.142

Basic k-mean

7

70.12

0.206

Proposed k-mean

500

K=2

1

Proposed k-mean

400

K=4

Basic k-mean
Proposed k-mean

300

1

82.19

0.186

Figure 2 depicts the performances of the original k-means algorithm and the proposed algorithm in terms of
the accuracy and time.

100
80
60
Accuracy(%)
40

Time (sec)

20
0
Basic Kmeans

Praposed
K-mean

Fig. 2Time and Accuracy of the algorithms

VI TECHNOLOGY USED
For the experiment of proposed K- mean clustering algorithm we are used the NetbeansIDE6.7
and the output of the results show with the help of text area present in the window developed for
the experiment. All the experiments held in tools will be performed on a 2.40GHz Intel(R) Core
(TM) i5-2430 MB memory, 2 GB RAM running on the windows XP Professional OS. Programs
will be coded in the java programming language.

VII CONCLUSION
In this paper, the improved algorithm of K-means clustering algorithm is proposed to overcome
the deficiency of the classical K-means clustering algorithm. The classical K-means algorithm
use the selecting the initial centroids approach .This algorithm performs well only when the data
sets are shorts and it suffers from increased number of data are more initial centroid problem. The
new proposed method use the systemically finds initial cenroid which reduces the number of data
base scans and it is useful for large amount of data base scan. This method ensures the entire
process of clustering time will be reduced in execution process.

18
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013

REFERENCES
[1]

A. K. Jain and R. C. Dubes, Algorithms for Clustering Data. Englewood Cliffs, NJ: Prentice-Hall,
1988.

[2]

S. Z. Selim and M. A. Ismail, “K-means type algorithms: a generalized convergence theorem and
characterization of local optimality,” in IEEE Transaction on Pattern Analysis and Machine
Intelligence, vol. 6, No. 1, pp. 81--87, 1984.

[3]

Jieming Zhou, J.G. and X. Chen, "An Enhancement of K-means Clustering Algorithm," in Business
Intelligence and Financial Engineering, BIFE '09. International Conference on, Beijing, 2009.

[4]

M.P.S Bhatia, Deepika Khurana Analysis of Initial Centers for k-Means Clustering Algorithm
International Journal of Computer Applications (0975 – 8887) Volume 71– No.5, May 2013

[5]

Dr. M.P.S Bhatia1 and Deepika Khurana Experimental study of Data clustering using k- Means and
modified algorithms International Journal of Data Mining & Knowledge Management Process
(IJDKP) Vol.3, No.3, May 2013

[6]

Kohei Arai and Ali Ridho Barakbah Hierarchical K-means: an algorithm for centroids initialization
for K-means Rep. Fac. Sci. Engrg. Reports of the Faculty of Science and Engineering, Saga Univ.
Saga University, Vol. 36, No.1, 2007 36-1 (2007),25-31

[7]

Napoleon, D. and P.G. Lakshmi An efficient K-Means clustering algorithm for reducing time
complexity using uniform distribution data points , 2010 in Trendz in Information Sciences and
Computing (TISC), Chennai

[8] S. Ray, and R. H. Turi, “Determination of number of clusters in kmeans clustering and application in
colour image segmentation, ”In Proceedings of the 4th International Conference on Advances in
Pattern Recognition and Digital Techniques, 1999, pp.137-143.
[9] Napoleon, D. and P.G. Lakshmi, 2010. "An Efficient
K-means Clustering Algorithm for Reducing Time Complexity using Uniform Distribution Data
Points," in Trendz in Information Sciences and Computing (TISC), Chennai.
[10] Dong, J. and M. Qi, "K-means Optimization Algorithm for Solving Clustering Problem," in Second
International Workshop on Knowledge Discovery and Data Mining (WKDD), Moscow 2009.

19

More Related Content

PPTX
K means clustring @jax
PDF
K means Clustering
PPT
K mean-clustering
PPT
K mean-clustering algorithm
PPTX
Large Scale Data Clustering: an overview
PPTX
K-means clustering algorithm
DOCX
Neural nw k means
PPTX
Kmeans
K means clustring @jax
K means Clustering
K mean-clustering
K mean-clustering algorithm
Large Scale Data Clustering: an overview
K-means clustering algorithm
Neural nw k means
Kmeans

What's hot (20)

PDF
K Means Clustering Algorithm | K Means Example in Python | Machine Learning A...
PDF
New Approach for K-mean and K-medoids Algorithm
PPT
K means Clustering Algorithm
PPTX
Pattern recognition binoy k means clustering
PPTX
K MEANS CLUSTERING
PPTX
K-Means clustring @jax
PPT
Enhance The K Means Algorithm On Spatial Dataset
PPTX
K-Means manual work
PPTX
K means clustering
PDF
Clustering: A Survey
PPT
Lect4
PPTX
Customer Segmentation using Clustering
PDF
K-Means, its Variants and its Applications
PPTX
K means clustering algorithm
PPTX
K means clustering | K Means ++
PDF
K means clustering
PPT
Clustering in artificial intelligence
PDF
K-means Clustering Algorithm with Matlab Source code
PPT
Intro to MATLAB and K-mean algorithm
PPT
CC282 Unsupervised Learning (Clustering) Lecture 7 slides for ...
K Means Clustering Algorithm | K Means Example in Python | Machine Learning A...
New Approach for K-mean and K-medoids Algorithm
K means Clustering Algorithm
Pattern recognition binoy k means clustering
K MEANS CLUSTERING
K-Means clustring @jax
Enhance The K Means Algorithm On Spatial Dataset
K-Means manual work
K means clustering
Clustering: A Survey
Lect4
Customer Segmentation using Clustering
K-Means, its Variants and its Applications
K means clustering algorithm
K means clustering | K Means ++
K means clustering
Clustering in artificial intelligence
K-means Clustering Algorithm with Matlab Source code
Intro to MATLAB and K-mean algorithm
CC282 Unsupervised Learning (Clustering) Lecture 7 slides for ...
Ad

Viewers also liked (20)

PPTX
Automatic handwriting recognition
PPTX
Mixed Numeric and Categorical Attribute Clustering Algorithm
PDF
Microscopic Digital Image Segmentation And feature Extraction of Acute Leukemia
PPTX
EMPLOYEE PERFORMANCE APPRAISAL (1)
PPTX
05 k-means clustering
PDF
Birch
PPTX
The financial analysis of P&G
PPTX
Procter and Gamble Financial Report
PPT
Cure, Clustering Algorithm
PPTX
01 Introduction to Data Mining
PPTX
05 Clustering in Data Mining
PPT
P&g slide full
PPT
Character Recognition using Artificial Neural Networks
PPTX
Handwritten character recognition using artificial neural network
PPTX
Presentation p&g final
PPTX
Lung Cancer
PPT
Genetic algorithm
PPT
Cancer PPT (From Mrs. Brenda Lee)
PPTX
Hierarchical clustering algo for wsn
PDF
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
Automatic handwriting recognition
Mixed Numeric and Categorical Attribute Clustering Algorithm
Microscopic Digital Image Segmentation And feature Extraction of Acute Leukemia
EMPLOYEE PERFORMANCE APPRAISAL (1)
05 k-means clustering
Birch
The financial analysis of P&G
Procter and Gamble Financial Report
Cure, Clustering Algorithm
01 Introduction to Data Mining
05 Clustering in Data Mining
P&g slide full
Character Recognition using Artificial Neural Networks
Handwritten character recognition using artificial neural network
Presentation p&g final
Lung Cancer
Genetic algorithm
Cancer PPT (From Mrs. Brenda Lee)
Hierarchical clustering algo for wsn
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
Ad

Similar to An improvement in k mean clustering algorithm using better time and accuracy (20)

PDF
Mine Blood Donors Information through Improved K-Means Clustering
PDF
Premeditated Initial Points for K-Means Clustering
PDF
50120140505013
PDF
The International Journal of Engineering and Science (The IJES)
PDF
A survey on Efficient Enhanced K-Means Clustering Algorithm
PDF
Experimental study of Data clustering using k- Means and modified algorithms
PDF
Optimising Data Using K-Means Clustering Algorithm
DOCX
K means report
PDF
84cc04ff77007e457df6aa2b814d2346bf1b
PDF
A Comparative Study Of Various Clustering Algorithms In Data Mining
PDF
Survey on Unsupervised Learning in Datamining
PDF
47 292-298
PPTX
Unsupervised learning Algorithms and Assumptions
PDF
Fuzzy clustering and fuzzy c-means partition cluster analysis and validation ...
PPTX
Unsupervised Machine Learning Algorithm K-means-Clustering.pptx
DOCX
Data Clusterng
PDF
Improving K-NN Internet Traffic Classification Using Clustering and Principle...
PDF
k-mean-clustering.pdf
DOCX
8.clustering algorithm.k means.em algorithm
Mine Blood Donors Information through Improved K-Means Clustering
Premeditated Initial Points for K-Means Clustering
50120140505013
The International Journal of Engineering and Science (The IJES)
A survey on Efficient Enhanced K-Means Clustering Algorithm
Experimental study of Data clustering using k- Means and modified algorithms
Optimising Data Using K-Means Clustering Algorithm
K means report
84cc04ff77007e457df6aa2b814d2346bf1b
A Comparative Study Of Various Clustering Algorithms In Data Mining
Survey on Unsupervised Learning in Datamining
47 292-298
Unsupervised learning Algorithms and Assumptions
Fuzzy clustering and fuzzy c-means partition cluster analysis and validation ...
Unsupervised Machine Learning Algorithm K-means-Clustering.pptx
Data Clusterng
Improving K-NN Internet Traffic Classification Using Clustering and Principle...
k-mean-clustering.pdf
8.clustering algorithm.k means.em algorithm

More from ijpla (20)

PDF
International Journal of Programming Languages and Applications (IJPLA) - CFP...
PDF
A study of the Behavior of Floating-Point Errors.pdf
PDF
International Journal of Programming Languages and Applications (IJPLA)
PDF
A study of the Behavior of Floating-Point Errors
PDF
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
PDF
International Journal of Programming Languages and Applications (IJPLA)
PDF
International Conference on Antennas, Microwave and Microelectronics Engineer...
PDF
INVESTIGATION OF ATTITUDES TOWARDS COMPUTER PROGRAMMING IN TERMS OF VARIOUS V...
PDF
Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...
PDF
2nd International Conference on Computing and Information Technology (CITE 2024)
PDF
International Journal of Programming Languages and Applications ( IJPLA )
PDF
A Hybrid Bacterial Foraging Algorithm For Solving Job Shop Scheduling Problems
PDF
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
PDF
International Journal of Programming Languages and Applications ( IJPLA )
PDF
3rd International Conference on Computing and Information Technology Trends (...
PDF
HIGH-LEVEL LANGUAGE EXTENSIONS FOR FAST EXECUTION OF PIPELINE-PARALLELIZED CO...
DOCX
Research Paper Submission- 5th International Conference on Machine Learning a...
PDF
Submit Your Articles- International Journal of Programming Languages and Appl...
PDF
SELFLESS INHERITANCE
PDF
Research Paper Submission- International Conference on Computer Science, Info...
International Journal of Programming Languages and Applications (IJPLA) - CFP...
A study of the Behavior of Floating-Point Errors.pdf
International Journal of Programming Languages and Applications (IJPLA)
A study of the Behavior of Floating-Point Errors
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
International Journal of Programming Languages and Applications (IJPLA)
International Conference on Antennas, Microwave and Microelectronics Engineer...
INVESTIGATION OF ATTITUDES TOWARDS COMPUTER PROGRAMMING IN TERMS OF VARIOUS V...
Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...
2nd International Conference on Computing and Information Technology (CITE 2024)
International Journal of Programming Languages and Applications ( IJPLA )
A Hybrid Bacterial Foraging Algorithm For Solving Job Shop Scheduling Problems
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
International Journal of Programming Languages and Applications ( IJPLA )
3rd International Conference on Computing and Information Technology Trends (...
HIGH-LEVEL LANGUAGE EXTENSIONS FOR FAST EXECUTION OF PIPELINE-PARALLELIZED CO...
Research Paper Submission- 5th International Conference on Machine Learning a...
Submit Your Articles- International Journal of Programming Languages and Appl...
SELFLESS INHERITANCE
Research Paper Submission- International Conference on Computer Science, Info...

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
Teaching material agriculture food technology
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Approach and Philosophy of On baking technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation theory and applications.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Unlocking AI with Model Context Protocol (MCP)
Review of recent advances in non-invasive hemoglobin estimation
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Reach Out and Touch Someone: Haptics and Empathic Computing
Chapter 3 Spatial Domain Image Processing.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Per capita expenditure prediction using model stacking based on satellite ima...
Teaching material agriculture food technology
The AUB Centre for AI in Media Proposal.docx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Programs and apps: productivity, graphics, security and other tools
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Approach and Philosophy of On baking technology
Machine learning based COVID-19 study performance prediction
Encapsulation theory and applications.pdf

An improvement in k mean clustering algorithm using better time and accuracy

  • 1. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013 An Improvement in K-mean Clustering Algorithm Using Better Time and Accuracy Er. Nikhil Chaturvedi1 and Er. Anand Rajavat2 1 Dept.of C.S.E, S.V.I.T.S, Indore (M.P)and 2 Asst. Prof, S.V.I.T.S, Indore Abstract: Cluster analysis or clustering is the task of grouping a set of objects in such a way that objects in the same group (called a cluster) are more similar (in some sense or another) to each other than to those in other groups (clusters).K-means is one of the simplest unsupervised learning algorithms that solve the well known clustering problem. The process of k means algorithm data is partitioned into K clusters and the data are randomly choose to the clusters resulting in clusters that have the same number of data set. This paper is proposed a new K means clustering algorithm we calculate the initial centroids systemically instead of random assigned due to which accuracy and time improved. Key words: Data mining, Cluster, Basic K-means algorithm, Improved K-means algorithm. I INTRODUCTION data mining refers to using a variety of techniques it identify suggests of information or decision making knowledge in the database and extracting these in such a way they can use different area such as decision support forecasting. The data is often voluminous. It is the hidden information in the data that is useful. Data mining depends on effective data collection and warehousing as well as computer processing. Data mining involves the use of sophisticated data analysis tools to discover previously unknown, valid pattern and relationship in large data set [1]. Clustering is one of the tasks of data mining. Clustering [2] is useful technique for the discovery of data distribution and patterns in the underlying data. The aim of clustering is to discover both dense and sparse regions in data set. The main two approaches to clustering - hierarchical clustering and partitioning clustering [3] K-mean algorithm is main categories of partitioning algorithm. The main difference between partitioned and hierarchical clustering is that, in partitioned clustering algorithm data is partitioned into more than two subgroups in hierarchical clustering algorithm data is divided into two subgroups in each step. K-mean clustering is a partitioning clustering technique in which clusters are formed with the help of centroids. On the basis of these centroids, clusters can vary from one another in different iterations. Moreover, data elements can vary from one cluster to another, as clusters are based on the random numbers known as initial centroids. A new algorithm is introduced and implemented in research. The whole paper is organized in this way. First the basic K-mean clustering algorithm is discussed and then proposed K-mean DOI : 10.5121/ijpla.2013.3402 13
  • 2. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013 clustering algorithm is explored. The implementation work and the results of experiments are followed by the comparison of both algorithms. II RELATED WORK In [4] the research of k-Means clustering algorithm is one of the clustering algorithms which have lot of used in applications because of its simplicity and implementation. K-Means algorithm’s is less accuracy because of selection of k initial centers is randomly. Therefore, in this paper surveyed different approaches for initial centers selection for k-Means algorithm. Comparative analysis of Original K-Means and improved k-Means Algorithm. In [5] this paper study of different approaches to k- Means clustering, and analysis of different datasets using Original k-Means and other modified algorithms. In [6] this paper main aim to reduce the initial centroid for k mean algorithm. This paper proposed Hierarchical K-means algorithm. It uses all the clustering algorithm results of K-means and reaches its local optimal. This algorithm is used for the complex clustering cases with large numbers of data set and many dimensional attributes because Hierarchical algorithm in order to determine the initial centroids for K-means. In [7] researchers introduced K mean clustering algorithm. This paper proposes method for the making K-means clustering algorithm more efficient and effective. In this paper time complexity improve using the unique data set. III BASIC K-MEAN CLUSTERING ALGORITHM K means clustering [8] is a partition-based cluster analysis method. According to this algorithm we firstly select k data value as initial cluster centers, then calculate the distance between each data value and each cluster center and assign it to the closest cluster, update the averages of all clusters, repeat this process until the criterion is not match. K means clustering aims to partition data into k clusters in which each data value belongs to the cluster with the nearest mean. Figure 1 shows how to process of the basic K mean clustering algorithm [9] in steps. Basic K-mean algorithm: Initially, we are chose K number of clusters in algorithm. The first step is to choose a set of K objects as centres of the clusters. Often chosen such that the objects are in distance basis how to one or more further away. In the next step of the algorithm considers each object and assigns it to the cluster which is closest. After that the cluster centroids are recalculated after each Object assignment, or after the whole cycle are completed. 14
  • 3. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013 This process is repeat until the all object are assign to its clusters. Fig. 1 K mean Algorithm Process IV PROPOSED ALGORITHM In the proposed clustering method discussed in this paper, for the original k-means algorithm is modified to improve the time and accuracy. Input: D is the set of all the data items k is number of clusters Output: A set of k clusters. Steps: Phase 1: For the initial centroids Input: D // set of n data k // Number of clusters Output: A set of k initial centroids. 15
  • 4. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013 Steps: 1. Set p = 1; 2. Measure the distance between each data and all other data in the set D; 3. Find the closest pair of data from the set D and form a data set Ap (1<= p <= k) which contains these two data, Delete these two data from the set D; 4. Find the data in D that is closest to the data set Ap, Add it to Ap and delete it from D; 5. Repeat step 4 until the number of data in Ap reaches all data in D; 6. If p<k, then p = p+1, find another pair of data from D between which the distance is the small form another data set Ap and delete them from D, Go to step 4; 7. for each data-point set Ap (1<=p<=k) find the mean of data in Ap. These means will be the initial centroids. Phase 2: Data to the clusters Input: D // set of n data. C // set of k centroids Output: A set of k clusters Steps: 1. Compute distance between each data to all the centroids 2. for each data di find the closest centroid ci and assing to cluster j. 3. Set ClusterCL[i] = j; // j:CL of the closest cluster 4. Set Shorter_Dist[i] = d (di, cj); 5. For each cluster j (1<=j<=k), recalculate the centroids; 6. Repeat 7. for each data di, 7.1 Compute the distance from the centroids of the closest cluster; 7.2 If distance is less than or equal to the present closest distance, the data-point stays in cluster; Else 7.2.1 For every centroids compute the distance. End for; 7.2.2 Data di assign to the cluster with the closest centroid cj 7.2.3 Set ClusterCL[i] =j; 7.2.4 Set Shorter_Dist[i] = d (di, cj); End for; 8. For each cluster j (1<=j<=k), recalculate the centroids; until the criteria is met. In the first phase, we determine initial centroids systematically. The second phase use of functions of the clustering method. It starts by the initial clusters based on the distance of each data from the initial centroids. These clusters are finding by using a heuristic approach, thereby improving the accuracy. In this phase compute the distance between the data and all other data from the data set. Then find out the closest pair of data and form a set A1 consisting of these two data, and delete them from the data set D. After that evaluate the data which is closest to the set A1, add it to A1 and delete it from D. Repeat this process until the all the element in the set A1 completed. Then go back to the second step and form another data set A2. Repeat this till ’k’ such 16
  • 5. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013 sets of data are obtained. Finally the initial centroids are obtained by averaging all the data in each data set. The Euclidean distance is used for determining the close of each data to the cluster centroids. The initial centroids of the clusters are used as input for the second phase, and assigning data to appropriate clusters. The first step in the second phase is to determine the distance between each data and the initial centroids of all the clusters. After that the data are assigned to the clusters having the closest centroids. This gives the results as initial grouping of the data. For each data the cluster to which it is assigned (ClusterCL) and its distance from the centroid of the nearest cluster (Shorter_Dist) are noted. For each cluster calculated the mean of the data values for the centroids. Until this step, the process is similar as original k-means algorithm except that the initial centroids are computed systematically. At time of iteration, the data may get redistributed to different clusters. The method involves distance between each data and the centroid of its present nearest cluster. At the time of starting the iteration, the distance of each data from the new centroid of its present nearest cluster is determined. If present distance is less than or equal to the previous nearest distance, that is an indication that the data point stays in that cluster itself and there is no need to computation of distance. This result save our time for required computing the distances to k-1 clusters centroids. On the other hand, if the new centroid of the present closest cluster is more distance from the its previous centroid, there is a chance for the data getting included in another nearer cluster. In that case, it is required to computation of distance from the centroids. New nearest cluster and record are identify for the new value of the nearest distance. The loop is repeated until no more data cross cluster boundaries. V EXPERIMENTAL RESULTS We apply both the algorithms original and proposed for the different number of records. Both the algorithms original and proposed need number of clusters as an input. In the basic K-means clustering algorithm set of initial centroids are required. The proposed method finds initial centroids systematically. The proposed method requires only the data and number of clusters as inputs. The basic K-means clustering algorithm is executed sevan times for the different data values of initial centroids . In each experiment the time was computed and taken the average time of all experiments. Table 1 shows the performance comparison of the Basic and proposed k-mean clustering algorithms. The experiments results show that the proposed algorithm is producing better results in less amounts of computational time and accuracy compared to the basic k-means algorithm. Table 1. Performance Comparison No. of Records 200 K=3 Algorithm Run Accuracy Executio n time in sec Basic k-mean 7 70.14 0.103 Proposed k-mean 100 No. Of Clust er K=3 1 82.66 0.083 Basic k-mean 7 70.10 0.128 17
  • 6. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013 Proposed k-mean K=2 82.11 0.098 7 70.57 0.144 1 82.31 0.122 Basic k-mean 7 70.44 0.162 1 82.34 0.142 Basic k-mean 7 70.12 0.206 Proposed k-mean 500 K=2 1 Proposed k-mean 400 K=4 Basic k-mean Proposed k-mean 300 1 82.19 0.186 Figure 2 depicts the performances of the original k-means algorithm and the proposed algorithm in terms of the accuracy and time. 100 80 60 Accuracy(%) 40 Time (sec) 20 0 Basic Kmeans Praposed K-mean Fig. 2Time and Accuracy of the algorithms VI TECHNOLOGY USED For the experiment of proposed K- mean clustering algorithm we are used the NetbeansIDE6.7 and the output of the results show with the help of text area present in the window developed for the experiment. All the experiments held in tools will be performed on a 2.40GHz Intel(R) Core (TM) i5-2430 MB memory, 2 GB RAM running on the windows XP Professional OS. Programs will be coded in the java programming language. VII CONCLUSION In this paper, the improved algorithm of K-means clustering algorithm is proposed to overcome the deficiency of the classical K-means clustering algorithm. The classical K-means algorithm use the selecting the initial centroids approach .This algorithm performs well only when the data sets are shorts and it suffers from increased number of data are more initial centroid problem. The new proposed method use the systemically finds initial cenroid which reduces the number of data base scans and it is useful for large amount of data base scan. This method ensures the entire process of clustering time will be reduced in execution process. 18
  • 7. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.4, October 2013 REFERENCES [1] A. K. Jain and R. C. Dubes, Algorithms for Clustering Data. Englewood Cliffs, NJ: Prentice-Hall, 1988. [2] S. Z. Selim and M. A. Ismail, “K-means type algorithms: a generalized convergence theorem and characterization of local optimality,” in IEEE Transaction on Pattern Analysis and Machine Intelligence, vol. 6, No. 1, pp. 81--87, 1984. [3] Jieming Zhou, J.G. and X. Chen, "An Enhancement of K-means Clustering Algorithm," in Business Intelligence and Financial Engineering, BIFE '09. International Conference on, Beijing, 2009. [4] M.P.S Bhatia, Deepika Khurana Analysis of Initial Centers for k-Means Clustering Algorithm International Journal of Computer Applications (0975 – 8887) Volume 71– No.5, May 2013 [5] Dr. M.P.S Bhatia1 and Deepika Khurana Experimental study of Data clustering using k- Means and modified algorithms International Journal of Data Mining & Knowledge Management Process (IJDKP) Vol.3, No.3, May 2013 [6] Kohei Arai and Ali Ridho Barakbah Hierarchical K-means: an algorithm for centroids initialization for K-means Rep. Fac. Sci. Engrg. Reports of the Faculty of Science and Engineering, Saga Univ. Saga University, Vol. 36, No.1, 2007 36-1 (2007),25-31 [7] Napoleon, D. and P.G. Lakshmi An efficient K-Means clustering algorithm for reducing time complexity using uniform distribution data points , 2010 in Trendz in Information Sciences and Computing (TISC), Chennai [8] S. Ray, and R. H. Turi, “Determination of number of clusters in kmeans clustering and application in colour image segmentation, ”In Proceedings of the 4th International Conference on Advances in Pattern Recognition and Digital Techniques, 1999, pp.137-143. [9] Napoleon, D. and P.G. Lakshmi, 2010. "An Efficient K-means Clustering Algorithm for Reducing Time Complexity using Uniform Distribution Data Points," in Trendz in Information Sciences and Computing (TISC), Chennai. [10] Dong, J. and M. Qi, "K-means Optimization Algorithm for Solving Clustering Problem," in Second International Workshop on Knowledge Discovery and Data Mining (WKDD), Moscow 2009. 19