トップ
新規
一覧
単語検索
最終更新
ヘルプ
ログイン
アールメカブ
Rでstring_Kernel
をテンプレートにして作成
開始行:
[[Rの備忘録]]
[[string kernel の作成 その 1 2007 08 18>R_fromOldHtml3_...
Text Classification using String Kernels:
Journal of Machine Learning Research 2 (2002) 419-444
二つのアルファベットが隣接する場合に&mathml(\lambda^2); ...
Lohdi の例からあげる.&mathml(\lambda^2); を簡単にλ^2と示...
φ(cat) λ^2 λ^3 λ^2 0 0 0 0 ...
φ(car) λ^2 0 0 0 0 λ^3 λ^2 ...
φ(bat) 0 0 λ^2 λ^2 λ^3 0 0 ...
φ(bar) 0 0 0 λ^2 0 0 λ^2...
ここで K(car,cat) = λ^4.つまりcarとcatの2行で,いわば論...
さらに正規化するならば,まず K(car,car) = K(cat,cat) = 2λ...
K(car,cat) = λ^4/(2λ^4 + λ^6) = 1/(2 + λ^2).
と正規化される.
さて,これをRで実行するには ''kernlab'' パッケージを利用...
test.str <- list("cat","car","bat","bar")
str.dot <- stringdot(length = 1, lambda = 0.5,
type = "sequence", normalized = TRUE)
list(kernelMatrix(str.dot, test.str)
test.str <- list("science is organized knowledge",
"wisdom is organized life")
str.kern.list <- NULL
for(i in 1:6){
str.dot <- stringdot(length = i, lambda = 0.5,
type = "sequence", normalized = TRUE)
str.kern.list[i] <- list(kernelMatrix(str.dot, test.st...
}
終了行:
[[Rの備忘録]]
[[string kernel の作成 その 1 2007 08 18>R_fromOldHtml3_...
Text Classification using String Kernels:
Journal of Machine Learning Research 2 (2002) 419-444
二つのアルファベットが隣接する場合に&mathml(\lambda^2); ...
Lohdi の例からあげる.&mathml(\lambda^2); を簡単にλ^2と示...
φ(cat) λ^2 λ^3 λ^2 0 0 0 0 ...
φ(car) λ^2 0 0 0 0 λ^3 λ^2 ...
φ(bat) 0 0 λ^2 λ^2 λ^3 0 0 ...
φ(bar) 0 0 0 λ^2 0 0 λ^2...
ここで K(car,cat) = λ^4.つまりcarとcatの2行で,いわば論...
さらに正規化するならば,まず K(car,car) = K(cat,cat) = 2λ...
K(car,cat) = λ^4/(2λ^4 + λ^6) = 1/(2 + λ^2).
と正規化される.
さて,これをRで実行するには ''kernlab'' パッケージを利用...
test.str <- list("cat","car","bat","bar")
str.dot <- stringdot(length = 1, lambda = 0.5,
type = "sequence", normalized = TRUE)
list(kernelMatrix(str.dot, test.str)
test.str <- list("science is organized knowledge",
"wisdom is organized life")
str.kern.list <- NULL
for(i in 1:6){
str.dot <- stringdot(length = i, lambda = 0.5,
type = "sequence", normalized = TRUE)
str.kern.list[i] <- list(kernelMatrix(str.dot, test.st...
}
ページ名: