libsvm为所有测试数据预测相同的值 - c#

时间:2016-03-14 14:42:30

标签: c# libsvm

我使用以下示例代码来读取training_file和testing_file。我的数据有三个等级0,1,2。我的模型的准确率约为40%。预测的所有输出是1.如何解决问题?

var prob = ProblemHelper.ReadAndScaleProblem(TRAINING_FILE);
var test = ProblemHelper.ReadAndScaleProblem(TEST_FILE);

var svm = new C_SVC(prob, KernelHelper.RadialBasisFunctionKernel(gamma), C);
var accuracy = svm.GetCrossValidationAccuracy(nr_fold);// with nr_fold > 1
for (int i = 0 ; i < test.l ; i++){
    var x = test.x[i];
    var y = test.y[i];
    var predictedY = svm.Predict(x); // returns the predicted value for 'x' attributes
}

0 个答案:

没有答案