- こちらで代数統計をいじっている
- あっちこっちで出てくる数学用語を頭の中で整理することを、こちらでやっている
- その心はこちらにあるような、「不確定な状態での判断」に関する伝達可能な表現が課題だからであって、それを指向した(市場調査?的側面を持たせた)ツールがこちら
- さて。用語を列挙してグラフ化してみる
- "代数統計.txt"というファイルに以下を書き込む
代数統計 代数 統計
分割表 周辺度数
分割表 log_linear_model 期待値
分割表 カテゴリ
分割表 次数
分割表 正単体
分割表 積
直積 積
直積 トーラス
log_linear_model 指数関数 積
積 独立
直積 カーネル イデアル
周辺度数 制約
制約 イデアル
イデアル 基底
基底 マルコフ基底 グレブナー基底
基底変換 変換 基底
陰関数 関数
陽関数 関数
陰関数 陽関数
関数変換 関数
陰関数変換 陰関数
マルコフ基底 グレブナー基底 陰関数変換
統計 分割表
代数 基底
library(igraph)
infiles <- list.files()
infile.list <- list()
for(i in 1:length(infiles)){
infile.list[[i]] <- read.table(infiles[i], sep = "\t", fill =TRUE)
}
g <- graph.empty(directed=FALSE)
g.plus <- graph.empty(directed=FALSE)
v.list <- list()
v.plus.list <- list()
e.list <- list()
e.plus.list <- list()
for(i in 1:length(infile.list)){
infile <- infile.list[[i]]
infile.m <- as.matrix(infile)
infile.m <- infile.m[,1:length(infile.m[1,])]
unique.word <- unique(c(infile.m))
unique.word <- unique.word[which(unique.word != "")]
v.list[[i]] <- NULL
v.list[[i]] <- unique.word
e.list[[i]] <- matrix(0,0,2)
v.plus.list[[i]] <- unique.word
e.plus.list[[i]] <- matrix(0,0,2)
for(j in 1:length(infile.m[,1])){
num.kids <- length(which(infile.m[j,] != ""))-1
if(num.kids>=1){
for(k in 1:num.kids){
e.list[[i]] <- rbind(e.list[[i]],c(infile.m[j,1],infile.m[j,k+1]))
}
}
}
sorted.e.list <- t(apply(e.list[[i]],1,sort))
tmp.v <- paste(sorted.e.list[,1],sorted.e.list[,2],sep="")
v.plus.list[[i]] <- c(unique.word,infiles[i],tmp.v)
v.plus.list[[i]] <- unique(v.plus.list[[i]])
for(j in 1:length(e.list[[i]][,1])){
e.plus.list[[i]] <- rbind(e.plus.list[[i]],c(e.list[[i]][j,1],tmp.v[j]))
e.plus.list[[i]] <- rbind(e.plus.list[[i]],c(e.list[[i]][j,2],tmp.v[j]))
e.plus.list[[i]] <- rbind(e.plus.list[[i]],c(tmp.v[j],infiles[i]))
}
}
unique.v <- unique(unlist(v.list))
unique.plus.v <- unique(unlist(v.plus.list))
g <- graph.empty(directed=FALSE) + vertices(unique.v)
g.plus <- graph.empty(directed=FALSE) + vertices(unique.plus.v)
for(i in 1:length(infile.list)){
for(j in 1:length(e.list[[i]][,1])){
g <- g + edges(e.list[[i]][j,])
}
for(j in 1:length(e.plus.list[[i]][,1])){
g.plus <- g.plus + edges(e.plus.list[[i]][j,])
}
}
plot(g,vertex.label=V(g)$name,vertex.size=3,edge.arrow.mode=0)
dev.new()
plot(g.plus,vertex.label=V(g.plus)$name,vertex.size=3,edge.arrow.mode=0)