当前位置:网站首页>Seriation in R: How to Optimally Order Objects in a Data Matrice
Seriation in R: How to Optimally Order Objects in a Data Matrice
2022-07-02 11:50:00 【Xiaoyu 2022】
library(seriation)
# Load the data
data("iris")
df <- iris
head(df, 2)
# Remove the column `species` (column 5)
df <- df[, -5]
# Reorder the objects randomly
set.seed(123)
df <- df[sample(seq_len(nrow(df))),]
head(df, 2)
# Compute dissimilarity matrix
dist_result <- dist(df)
# Seriate objects, reorder rows based on their similarity
object_order <- seriate(dist_result)
# Extract object orders
head(get_order(object_order), 15)
pimage(dist_result, main = "Random order")

library(seriation)
# Load the data
data("iris")
df <- iris
head(df, 2)
# Remove the column `species` (column 5)
df <- df[, -5]
# Reorder the objects randomly
set.seed(123)
df <- df[sample(seq_len(nrow(df))),]
head(df, 2)
# Compute dissimilarity matrix
dist_result <- dist(df)
# Seriate objects, reorder rows based on their similarity
object_order <- seriate(dist_result)
# Extract object orders
head(get_order(object_order), 15)
pimage(dist_result, order = object_order, main = "Reordered")

library(seriation)
# Data preparation
# Load the dataset
data("USArrests")
# Replace original values by their ranks
df <- head(apply(USArrests, 2, rank), 30)
# Perform seriation on row and columns
row_order <- seriate(dist(df, "minkowski", p = 1), method ="TSP")
col_order <- seriate(dist(t(df), "minkowski", p = 1), method ="TSP")
orders <- c(row_order, col_order)
# Visualization: matrix of bars
# Original matrix
bertinplot(df)

library(seriation)
# Data preparation
# Load the dataset
data("USArrests")
# Replace original values by their ranks
df <- head(apply(USArrests, 2, rank), 30)
# Perform seriation on row and columns
row_order <- seriate(dist(df, "minkowski", p = 1), method ="TSP")
col_order <- seriate(dist(t(df), "minkowski", p = 1), method ="TSP")
orders <- c(row_order, col_order)
# Visualization: matrix of bars
# Original matrix
bertinplot(df, orders)

library(seriation)
# Load demo data
data("Townships")
# Visualize the original data
bertinplot(
Townships,
options = list(panel = panel.circles)
)

library(seriation)
# Load demo data
data("Townships")
# Seriate rows and columns using the bond energy algorithm (BEA)
set.seed(1234)
orders <- seriate(Townships, method = "BEA", control = list(rep = 10))
bertinplot(
Townships, order = orders,
options = list(panel = panel.circles)
)
边栏推荐
- Solve the problem of data blank in the quick sliding page of the uniapp list
- PHP 2D and multidimensional arrays are out of order, PHP_ PHP scrambles a simple example of a two-dimensional array and a multi-dimensional array. The shuffle function in PHP can only scramble one-dim
- 微信小程序利用百度api达成植物识别
- How to Add P-Values onto Horizontal GGPLOTS
- Map set assignment to database
- Principle of scalable contract delegatecall
- 可升级合约的原理-DelegateCall
- Power Spectral Density Estimates Using FFT---MATLAB
- ROS lacks xacro package
- PX4 Position_ Control RC_ Remoter import
猜你喜欢

A white hole formed by antineutrons produced by particle accelerators

Eight sorting summaries

How to Create a Beautiful Plots in R with Summary Statistics Labels

Some problems encountered in introducing lvgl into esp32 Arduino

Tiktok overseas tiktok: finalizing the final data security agreement with Biden government

Develop scalable contracts based on hardhat and openzeppelin (II)

动态内存(进阶四)

mysql链表数据存储查询排序问题

揭露数据不一致的利器 —— 实时核对系统

Webauthn - official development document
随机推荐
HOW TO ADD P-VALUES TO GGPLOT FACETS
进入前六!博云在中国云管理软件市场销量排行持续上升
Cluster Analysis in R Simplified and Enhanced
What week is a date obtained by QT
File operation (detailed!)
Tiktok overseas tiktok: finalizing the final data security agreement with Biden government
A white hole formed by antineutrons produced by particle accelerators
多文件程序X32dbg动态调试
GGPlot Examples Best Reference
On April 17, 2022, the five heart matchmaker team received double good news
Industry analysis
BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
亚马逊云科技 Community Builder 申请窗口开启
How to Create a Beautiful Plots in R with Summary Statistics Labels
Homer forecast motif
map集合赋值到数据库
2022年4月17日五心红娘团队收获双份喜报
Programmer growth Chapter 6: how to choose a company?
通讯录的实现(文件版本)
php 根据经纬度查询距离
