K-Means Clustering with Matlab

Data Mining/01.04.2013/Sistem Informasi

You can see the explanation: http://en.wikipedia.org/wiki/K-means_clustering. K-means is hard-clustering that different with Fuzzy C-Means that Soft-Clustering.

File – New – GUI. Make a design below.

Save yout GUI.

Fill script to function ambildata_Callback:

  • data=uigetfile(‘*.xlsx’)
  • set(handles.data,‘String’,data)
  • X=xlsread(data)
  • handles.X=X
  • guidata(hObject,handles)

 

Look at command window to see the result

Script function data_Callback (text box of number of cluster)

Make sure k and handles.k appear in Command Window.

IDX and C the result of kmeans function that state index of every record and center of cluster respectively.

Look at how to create excel file with function xlswrite. There are two sheets: hasil and kluster. Use “set” for sending result to edit text ipa1, ipa2, ips1, and ips2 at GUI.

You can add axes to show the result graphically.

  • %buat grafik
  • ukuran=size(hasil)
  • jlhdata=ukuran(1,1)
  • axes(handles.axes1)
  • hold
  • for i=1:jlhdata
  • if hasil(i,3)==1
  • plot(hasil(i,1),hasil(i,2),‘*r’)
  • else
  • plot(hasil(i,1),hasil(i,2),‘*b’)
  • end
  • end
  • plot(C(1,1),C(1,2),‘ok’)
  • plot(C(2,1),C(2,2),‘ok’)

Next week we’ll discuss Fuzzy C-Means Clustering.

Tentang rahmadya

I'm a simple man .. Lahir di Sleman Yogyakarta, 7 Juni 1976 PENDIDIKAN: TK : - (tidak ada TK di tj Priok waktu itu) SDN : Papanggo, Jakarta 83 - 89 SMPN : 129, Jakarta 89 - 92 SMAN : 8, Yogyakarta 92 - 95 Univ. : Fak. Teknik UGM, Yogyakarta 95 - 2001 Pasca. : Tek. Informatika STMIK Nusa Mandiri, Jakarta 2008 - 2010 Doctoral : Information Management Asian Institute of Technology, Thailand 2013 - 2018 PEKERJAAN: Tek. Komputer AMIK BSI Jakarta : 2002 - 2005 IT Danamon Jakarta : 2005 - 2008 Tek. Informatika STMIK Nusa Mandiri Jakarta : 2005 - 2008 Univ. Darma Persada Jakarta: 2008 - 2013 Fakultas Teknik Universitas Islam "45" Bekasi : 2008 - Skrg ( Homebase) Univ. Bhayangkara Jakarta Raya: 2018 - Skrg Univ. Nusa Putra Sukabumi: 2018 - Skrg
Pos ini dipublikasikan di Darma Persada, Data Mining. Tandai permalink.

6 Balasan ke K-Means Clustering with Matlab

  1. dina berkata:

    Pak, saya mau bertanya
    Kalau untuk code program “buat grafik” itu ditaruhnya dimana ya Pak? Soalnya saya baru berhasil mempraktikkan sampai data hasil kesimpan.
    Terimakasih sebelumnya

  2. Pak Saya boleh minta source codenya buat referensi tugas pak, Email Saya Arlinstmik@yahoo.com

  3. Kelix berkata:

    assalamualaikum wr wb
    selamat sore pak. saya minta izin untuk memakai source code yang sdh dishare di website bapak ya pak?
    terimakasih

    Kurnia AC, Dosen Polindra

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.