【发布时间】:2018-07-15 11:09:08
【问题描述】:
我试图通过 SVM 预测回报的迹象,但由于结果不佳而在某处出现错误。
x <- sign(dataset)
trainindex1= x[1:5792,1]
trainindex2 = x[1:5792,-1]
testindex = x[5792:7030,-1]
trainindex1 <- as.factor(trainindex1)
trainindex2 <- as.vector(trainindex2)
testindex <- as.vector(testindex)
svmFit = svm (y=trainindex1, x=trainindex2,
type="C",
kernel= "radial",
gamma=5,
cost=30)
predsvm = predict(svmFit, testindex)
table(predsvm, testindex)
结果
testindex
predsvm -1 0 1
-1 0 0 0
0 0 0 0
1 2819 5 3371
请你帮我解释一下我该如何解决它?
【问题讨论】:
-
您的训练数据是什么样的?
predsvm返回什么?你的训练数据有多平衡?您的测试样品是否具有代表性?您是如何选择超参数和内核的? -
训练数据只是 1990 年到 2013 年财务回报的迹象。我有 2013 年到 2017 年的真实迹象,想比较一下。我尝试了不同的内核和参数,但没有任何变化。我想在我更改参数和内核之前应该先解决一些问题。
标签: r svm prediction