我从http://www.csie.ntu.edu.tw/~cjlin/libsvm/下载了用于C#的libsvm 我找到了一些示例代码。示例代码是:
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
var probabilities = svm.PredictProbabilities(x); // returns the probabilities for each class
// Note : in about accuracy% of cases, 'predictedY' should be equal to 'y'
}
但是libsvm命名空间并没有结束&#34; ProblemHelper&#34; &安培; &#34; C_SVC&#34 ;.是代码的问题? 任何人都可以通过示例代码帮助我吗? 感谢