Tuesday, January 31, 2017

Tutorial K-Means Clustering with Matlab

Tutorial K-Means Clustering with Matlab
Saya  teringat dengan pembuatan skripsi saya yang waktu itu saya buat dengan metode clustering algoritma K-means dengan program aplikasi pengujian menggunakan Matlab program.
File – New – GUI. Make a design below.
Description: http://rahmadyatrias.files.wordpress.com/2013/04/040113_0432_kmeansclust1.png?w=593
Save yout GUI.
Description: http://rahmadyatrias.files.wordpress.com/2013/04/040113_0432_kmeansclust2.png?w=593
Fill script to function ambildata_Callback:
  • data=uigetfile(‘*.xlsx’)
  • set(handles.data,‘String’,data)
  • X=xlsread(data)
  • handles.X=X
  • guidata(hObject,handles)

Description: http://rahmadyatrias.files.wordpress.com/2013/04/040113_0432_kmeansclust3.png?w=593
Look at command window to see the result
Script function data_Callback (text box of number of cluster)
Description: http://rahmadyatrias.files.wordpress.com/2013/04/040113_0432_kmeansclust4.png?w=593
Make sure k and handles.k appear in Command Window.
Description: http://rahmadyatrias.files.wordpress.com/2013/04/040113_0432_kmeansclust5.png?w=593
IDX and C the result of kmeans function that state index of every record and center of cluster respectively.
Description: http://rahmadyatrias.files.wordpress.com/2013/04/040113_0432_kmeansclust6.png?w=593
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.
Description: http://rahmadyatrias.files.wordpress.com/2013/04/040113_0432_kmeansclust7.png?w=593
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’)

ok,  selamat mencoba semoga berhasil.

No comments:

Post a Comment

Cara dan Contoh Pembuatan Surat Keputusan Drop Out (DO)

SURAT KEPUTUSAN KETUA SEKOLAH TINGGI MANAJEMEN INFORMATIKA DAN KOMPUTER (STMIK) TRIGUNA DHARMA  Nomor : 091/STMIK-TGD/KA/V/2018  Tentang PEM...