やってみる

金塊問題のデータセットをhundred.txtとして保存する。
T:決定木、R:RBF-kernel SVM、N:linear-kernel SVM、S:決定株のモデルをいくつか組み合わせてみる。

#detectスクリプトがあるfracディレクトリで
python detect -X ~/Desktop/hundred.txt -Q ~/Desktop/hundred.txt -T -R -N -S -w ~/Desktop/weka-3-6-9/weka.jar > result1.txt
python detect -X ~/Desktop/hundred.txt -Q ~/Desktop/hundred.txt    -R -N -S -w ~/Desktop/weka-3-6-9/weka.jar > result2.txt
python detect -X ~/Desktop/hundred.txt -Q ~/Desktop/hundred.txt -T          -w ~/Desktop/weka-3-6-9/weka.jar > result3.txt
python detect -X ~/Desktop/hundred.txt -Q ~/Desktop/hundred.txt          -S -w ~/Desktop/weka-3-6-9/weka.jar > result4.txt
python detect -X ~/Desktop/hundred.txt -Q ~/Desktop/hundred.txt -T       -S -w ~/Desktop/weka-3-6-9/weka.jar > result5.txt

ここからRでやる。

#上の結果が出力されたディレクトリで。detectスクリプトがあったところ。つまりfrac。
frac <- matrix(unlist(mapply(read.delim, paste("result", 1:5, ".txt", sep=""), header=FALSE)), nc=5)
colnames(frac) <- c("TRNS", " RNS", "T   ", "   S", "T  S")

matplot(frac, , ylab="Anomaly score", main="FRaC", pch=16)
abline(h=apply(frac, 2, median), col=seq(ncol(frac)), lty=2)
abline(v=87, lty=2)
legend("topleft", legend=colnames(frac), col=seq(ncol(frac)), bty="n", pch=16)

分布から仲間はずれになればなるほど、外れ値は他の点とanomaly scoreが異なるだろう。
LOFのように1に近い、という感じではなかったので、中央値をとってみてそれから外れていれば外れ値ではないかと思ってみる。
すべてのモデルを組み込んだTRNS(黒)が最も外れたanomaly scoreを出している。しかも87番に一致するのでいい感じな予感。