0% found this document useful (0 votes)
75 views12 pages

Cluster Analysis Hierarchical Cluster

This document discusses cluster analysis techniques, specifically hierarchical clustering and k-means clustering. It provides examples of using these techniques in Excel, R, and Python to group objects based on their similarity measured by distance between data points. It includes a sample iris dataset and instructions to perform k-means clustering with k=3 clusters using Excel and R.

Uploaded by

fadhil_ghifari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views12 pages

Cluster Analysis Hierarchical Cluster

This document discusses cluster analysis techniques, specifically hierarchical clustering and k-means clustering. It provides examples of using these techniques in Excel, R, and Python to group objects based on their similarity measured by distance between data points. It includes a sample iris dataset and instructions to perform k-means clustering with k=3 clusters using Excel and R.

Uploaded by

fadhil_ghifari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Cluster Analysis

Dr. Dedy Sugiarto, SSi,MM

Program Studi Sistem Informasi


FTI – Universitas Trisakti
Cluster Analysis ~ Teknik mengelompokkan obyek

• Analisis klaster dapat digunakan untuk mengelompokkan obyek berdasarkan nilai


kemiripannya (similarity) dengan menggunakan konsep jarak antara dua titik
• Dua metode yang dipelajari adalah hierarchical clustering (hirarkis) dan k-
means
cluster (non hirarkis)

(https://en.wikipedia.org/wiki/Euclidean_distance)
Contoh sederhana

(Sharma, 1996)
Hierarchical cluster algorithm
https://www.datanovia.com/en/lessons/agglomerative-hierarchical-clustering/
Step by step in Excel
Step by step in Excel
R Script library("readxl")
#my_data <- read_excel(file.choose(), sheet = "",range
= "")
my_data <- read_excel("E:/Kuliah Multivariate Genap
1819/Cluster analysis/clusterPage127.xlsx",na = "-")
df=my_data[,2:3]
df
d <- dist(df, method = "euclidean")
d
hc1 <- hclust(d, method = "complete" )
plot(hc1, cex = 0.6, hang = -1)

Script R
#Euclidean Distance
dataku=read.delim("clipboard")
df=dataku[,2:3]
d.euc <- dist(df)
d.sqeuc <- d.euc^2
Hierarchical cluster in python
https://medium.com/@gifadelyaninursyafitri/k-means-clustering-menggunakan-python-deeb0881333c
python :
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

data = pd.read_excel("E:/Kuliah Multivariate Genap 1819/Cluster analysis/clusterPage127.xlsx")


data.head()
data=data[["Income","Education"]]
from sklearn.preprocessing import normalize
data_scaled = normalize(data)

data_scaled = pd.DataFrame(data_scaled, columns=data.columns)


data_scaled.head()
import scipy.cluster.hierarchy as shc
plt.figure(figsize=(10, 7))
plt.title("Dendrograms")

dend = shc.dendrogram(shc.linkage(data_scaled, method='ward'))


Latihan

Berikut dibawah ini adalah data dimensi bunga iris. Lakukan analisis cluster melalui
excel dan R menggunakan metode k-mean cluster (jumlah cluster 3)

petal length petal width iris


1.4 0.15 i1
1.3 0.2 i2
3.5 1.5 i3
3.7 1.3 i4
5.1 1.8 i5
5.3 1.9 i6

(Sharma, 1996)

You might also like