R
sunburst
Visualization
Report
資料視覺化
library(TraMineR)
# use example from TraMineR vignette
data("mvad")
mvad.alphab <- c(
"employment", "FE", "HE", "joblessness",
"school", "training"
)
mvad.seq <- seqdef(mvad, 17:86, xtstep = 6, alphabet = mvad.alphab)
Learn More →
# To make this work, we'll compress the sequences with seqdss
library(pipeR)
seqtab( seqdss(mvad.seq), tlim = 0, format = "SPS" ) %>>%
attr("freq") %>>%
(
data.frame(
# appending "-end" is necessary for this to work
sequence = paste0(
gsub(
x = rownames(.)
, pattern = "(/[0-9]*)" # 把不斷重複的'/1'拿掉
, replacement = ""
, perl = T # 是否使用perl兼容的正則表達式(regexps)
)
,"-end"
)
,freq = as.numeric(.$Freq)
,stringsAsFactors = FALSE
)
) %>>%
sunburst
library(tibble)
seq_df = seqtab( seqdss(mvad.seq), idxs = 0, format = "SPS" ) %>%
attr("freq") %>%
rownames_to_column("Path")
seq_df$Path = gsub('/1', "" , seq_df$Path) %>% paste0("-end")
library(sunburstR)
sequence_data <- read.csv(
paste0(
"https://gist.githubusercontent.com/kerryrodden/7090426/",
"raw/ad00fcf422541f19b70af5a8a4c5e1460254e6be/visit-sequences.csv"
)
,header=F
,stringsAsFactors = FALSE
)
sunburst(sequence_data)
Learn More →
index = grep("^home-home",sequence_data$V1) # 由home開頭的序列
sum(sequence_data$V2[index])/sum(sequence_data$V2)
[1] 0.06031
Other Reference: Rpubs R Markdown Theme date: '`r Sys.Date()`' output: rmdformats::material # readthedown date: "`r Sys.Date()`" output: prettydoc::html_pretty:
Aug 3, 2022Reference: http://ccckmit.wikidot.com/st:test1 d = density function 連續型 p = cumulative distribution function 離散 q = quantile function r = random number generation # 累積的常態機率分布 pnorm(175, mean = 170, sd = 5) - pnorm(170, 170, 5) # 計算170到175中間的那塊常態分布面積(mean:170, x:175, sd:5)
Nov 1, 2021Reference: Michael Hahsler(2011). "recommenderlab: A Framework for Developing and Testing Recommendation Algorithms." 推薦系統基本觀念—Collaborative Filtering(協同式過濾) 1. User-based Collaborative Filtering(UBCF) Memory-based CF 採用「全部」或巨量的使用者資料去進行推薦→佔記憶體 推薦系統通常是在線上進行運算,因此上述特性會不利於演算速度 原理
Aug 24, 2020Reference: Ebook Dataset: 古騰堡書庫 Regex in R 尋找 符號 舉例
Jun 20, 2020or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up