我想看看什麼是可能與R和SVM(e1071)。但混淆矩陣的結果要顯示的很大。混淆矩陣太大了,解釋SVM結果的其他方法?
出於測試目的,我使用Yahoo Finance的Yahoo stock數據集。
我的R指令集是這樣的:
> library(e1071)
> yahooData <- read.csv(file="../StockData/yahoo/yahoo-full.csv")
> yahooData[1,]
Date Open High Low Close Volume Adj.Close
1 2014-01-17 40.12 40.44 39.47 40.01 19262500 40.01
> dim(yahooData)
[1] 4473 7
> yIndex <- 1:nrow(yahooData)
> yTestindex <- sample(yIndex, trunc(length(yIndex)/3))
> yTestset <- yahooData[yTestindex,]
> yTrainset <- yahooData[-yTestindex,]
> dim(yTestset)
[1] 1491 7
> dim(yTrainset)
[1] 2982 7
>
> # svm
> ySVMmodel <- svm(Close ~ ., data = yTrainset)
> ySVMpred <- predict(ySVMmodel, yTestset[,-5])
我SVM模型的總結和預測是:
> summary(ySVMmodel)
Call:
svm(formula = Close ~ ., data = yTrainset)
Parameters:
SVM-Type: eps-regression
SVM-Kernel: radial
cost: 1
gamma: 0.000223314
epsilon: 0.1
Number of Support Vectors: 493
> summary(ySVMpred)
Min. 1st Qu. Median Mean 3rd Qu. Max.
12.55 20.96 31.93 49.84 43.55 401.10
在我想要得到的混淆矩陣,看我的結果結束,但矩陣是到大,我不能得到任何信息出來的:
> table(pred = ySVMpred, true = yTestset[,5])
是存在的,混淆矩陣的旁邊,另一種方法看predi創造價值?或者縮小混淆矩陣來獲得結果的另一種方法?
爲什麼你想要一個帶有連續結果的迴歸問題的混淆矩陣?我錯過了什麼嗎?它通常對分類任務很有用。 – dickoa