当前位置:网站首页>Cluster Analysis in R Simplified and Enhanced
Cluster Analysis in R Simplified and Enhanced
2022-07-02 09:38:00 【小宇2022】
install.packages("factoextra")
library(factoextra)
# Load and scale the dataset
data("USArrests")
df <- scale(USArrests)
head(df)
library(factoextra)
# Correlation-based distance method
res.dist <- get_dist(df, method = "pearson")
head(round(as.matrix(res.dist), 2))[, 1:6]
# Visualize the dissimilarity matrix
fviz_dist(res.dist, lab_size = 8)
# Load and scale the dataset
data("USArrests")
df <- scale(USArrests)
# Compute dissimilarity matrix
res.dist <- dist(df, method = "euclidean")
# Compute hierarchical clustering
res.hc <- hclust(res.dist, method = "ward.D2")
# Visualize
plot(res.hc, cex = 0.5)
eclust(x, FUNcluster = "kmeans", hc_metric = "euclidean", ...)
library("factoextra")
# Enhanced k-means clustering
res.km <- eclust(df, "kmeans", nstart = 25)
library("factoextra")
# Gap statistic plot
fviz_gap_stat(res.km$gap_stat)
library("factoextra")
# Silhouette plot
fviz_silhouette(res.km)
library("factoextra")
res.hc <- eclust(df, "hclust") # compute hclust
fviz_dend(res.hc, rect = TRUE) # dendrogam
library("factoextra")
fviz_silhouette(res.hc) # silhouette plot
library("factoextra")
fviz_cluster(res.hc) # scatter plot
边栏推荐
- 2022年4月17日五心红娘团队收获双份喜报
- Never forget, there will be echoes | hanging mirror sincerely invites you to participate in the opensca user award research
- ROS lacks catkin_ pkg
- CTF record
- TIPC protocol
- Principe du contrat évolutif - delegatecall
- Resources reads 2D texture and converts it to PNG format
- Tick Data and Resampling
- 二.Stm32f407芯片GPIO编程,寄存器操作,库函数操作和位段操作
- Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
猜你喜欢
MySQL comparison operator in problem solving
Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?
亚马逊云科技 Community Builder 申请窗口开启
Why does LabVIEW lose precision in floating point numbers
From the perspective of attack surface, see the practice of zero trust scheme of Xinchuang
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
二.Stm32f407芯片GPIO编程,寄存器操作,库函数操作和位段操作
[idea] use the plug-in to reverse generate code with one click
Always report errors when connecting to MySQL database
抖音海外版TikTok:正与拜登政府敲定最终数据安全协议
随机推荐
高德根据轨迹画线
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
Never forget, there will be echoes | hanging mirror sincerely invites you to participate in the opensca user award research
map集合赋值到数据库
Introduction to interface debugging tools
Rest (XOR) position and thinking
Precautions for scalable contract solution based on openzeppelin
Why does LabVIEW lose precision in floating point numbers
Internship report skywalking distributed link tracking?
Xiao Sha's pain (double pointer
Eight sorting summaries
Some things configured from ros1 to ros2
电脑无缘无故黑屏,无法调节亮度。
Pit of the start attribute of enumrate
String (Analog
ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪
从攻击面视角,看信创零信任方案实践
From the perspective of attack surface, see the practice of zero trust scheme of Xinchuang
LVM操作
webauthn——官方开发文档