l K-均值聚类(K-Means) 十大经典算法
l K-中心点聚类(K-Medoids)
l 密度聚类(DBSCAN)
l 系谱聚类(HC)
l 期望最大化聚类(EM) 十大经典算法
聚类算法 |
软件包 |
主要函数 |
K-means |
stats |
kmeans() |
K-Medoids |
cluster |
pam() |
系谱聚类(HC) |
stats |
hclust(), cutree(), rect.hclust() |
密度聚类(DBSCAN) |
fpc |
dbscan() |
期望最大化聚类(EM) |
mclust |
Mclust(), clustBIC(), mclust2Dplot(), densityMclust() |
K-means
countries =read.table("birth.txt",head=F)
#K-均值(K-means)聚类 kmeans() packages: stats
library(stats)
fit_km1 =kmeans(countries[,-1],center=3)
print(fit_km1)
K-means clustering with 3 clusters of sizes22, 20, 26
Cluster means:
birth death
1 17.53636 9.918182
2 25.01500 7.890000
3 42.57692 12.703846
Clustering vector:
ALGERIA CONGO EGYPT GHANA IVORY-COAST MALAGASY
3 3 3 3 3 3
MOROCCO TUNISIA CAMBODIA CEYLON CHINA TAIWAN
3 3 3 3 3 3
HONG-KONG INDIA INDONESIA IRAQ JAPAN JORDAN
2 1 2 2 1 3
KOREA MALAYSIA MONGOLIA PHILLLIPINES SYRIA THAILAND
1 2 3 2 2 3
VIETNAM CANADA COSTA-RICA DOMINICAN-R GUATEMALA HONDURAS
2 2 3 2 3 3
MEXICO NICARAGUA PANAMA UNITED-STATES ARGENTINA BOLIVIA
3 3 3 2 2 1
BRAZIL CHILE COLOMBIA