当前位置:网站首页>Cluster Analysis in R Simplified and Enhanced
Cluster Analysis in R Simplified and Enhanced
2022-07-02 11:43:00 【Xiaoyu 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
边栏推荐
- What are the methods of adding elements to arrays in JS
- TIPC Getting Started6
- 基于Hardhat和Openzeppelin开发可升级合约(一)
- Order by注入
- liftOver进行基因组坐标转换
- 解决uniapp列表快速滑动页面数据空白问题
- Xiao Sha's pain (double pointer
- Is it safe to open a stock account through the QR code of the securities manager? Or is it safe to open an account in a securities company?
- 可昇級合約的原理-DelegateCall
- Develop scalable contracts based on hardhat and openzeppelin (II)
猜你喜欢
On April 17, 2022, the five heart matchmaker team received double good news
webauthn——官方开发文档
TIPC addressing 2
PowerBI中导出数据方法汇总
Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)
JS——每次调用从数组里面随机取一个数,且不能与上一次为同一个
MTK full dump grab
[idea] use the plug-in to reverse generate code with one click
Tick Data and Resampling
亚马逊云科技 Community Builder 申请窗口开启
随机推荐
对毕业季即将踏入职场的年轻人的一点建议
R HISTOGRAM EXAMPLE QUICK REFERENCE
解决uniapp列表快速滑动页面数据空白问题
制造业数字化转型和精益生产什么关系
Summary of data export methods in powerbi
函数式接口和方法引用
STM32 single chip microcomputer programming learning
念念不忘,必有回响 | 悬镜诚邀您参与OpenSCA用户有奖调研
Homer预测motif
Skills of PLC recorder in quickly monitoring multiple PLC bits
Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?
TIPC Getting Started6
C file and folder operation
QT获取某个日期是第几周
webauthn——官方开发文档
Eight sorting summaries
Xiao Sha's pain (double pointer
CentOS8之mysql基本用法
TIPC Service and Topology Tracking4
接口调试工具概论