DMData Mining Techniques
All experiments

Experiment 10

Implement K-Means Clustering Using WEKA

Aim

To understand and implement k-means clustering in weka using WEKA data mining tool.

Procedure

  1. Open WEKA
    • Start WEKA → choose Explorer.
  2. Load Dataset
    • Click Open file → select a dataset (e.g., iris.arff from WEKA's sample datasets).
  3. Go to Cluster Tab
    • Click on the Cluster tab.
  4. Choose SimpleKMeans
    • In the "Clusterer" panel, click the Choose button.
    • Select: weka.clusterers.SimpleKMeans.
  5. Set Options
    • Click on SimpleKMeans to configure:
      • Number of clusters (k): Enter the desired number of clusters (e.g., 3 for Iris).
      • Distance function (default: EuclideanDistance).
      • Initialization method (default: random).
      • Max iterations (default: 500).
  6. Run Clustering
    • Click Start.
    • WEKA will run KMeans and output:
      • Cluster centroids.
      • Cluster assignments for each instance.
      • Within-cluster sum of squared errors.
  7. Visualize Clusters
    • Click Visualize cluster assignments.
    • You can select attributes for X-axis and Y-axis to see cluster separation.

Example: KMeans on Iris Dataset

  • Dataset: iris.arff
  • k=3
  • Output will show cluster centroids for attributes (Sepal length, Sepal width, Petal length, Petal width).
  • WEKA will also map clusters to class labels (e.g., cluster 0 → Iris-setosa).

Output

Implement K-Means Clustering Using WEKA output screenshot 1Implement K-Means Clustering Using WEKA output screenshot 2Implement K-Means Clustering Using WEKA output screenshot 3Implement K-Means Clustering Using WEKA output screenshot 4

Result

The experiment was successfully executed, and the expected output was obtained using WEKA.