本文介绍了使用C#和"Accord.NET"进行非线性支持向量回归.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Accord中使用C#进行非线性矢量回归时应使用什么?谢谢(traininginputs double [] []和trainingoutput double [] NOT int [])
what should I use for non-linear vector regression with C# in Accord ?Thanks(traininginputs double[][] and trainingoutput double[] NOT int[])
推荐答案
Accord.NET为 SequentialMinimalOptimizationRegression 类.示例应用程序的此主题中有一个示例应用程序Wiki页面.
Accord.NET provides a Support Vector Machine learning algorithm for regression problems in the SequentialMinimalOptimizationRegression class. There is an example application for this topic in the sample application's wiki page.
以下是使用方法的示例:
Here is an example on how to use it:
// Example regression problem. Suppose we are trying
// to model the following equation: f(x, y) = 2x + y
double[][] inputs = // (x, y)
{
new double[] { 0, 1 }, // 2*0 + 1 = 1
new double[] { 4, 3 }, // 2*4 + 3 = 11
new double[] { 8, -8 }, // 2*8 - 8 = 8
new double[] { 2, 2 }, // 2*2 + 2 = 6
new double[] { 6, 1 }, // 2*6 + 1 = 13
new double[] { 5, 4 }, // 2*5 + 4 = 14
new double[] { 9, 1 }, // 2*9 + 1 = 19
new double[] { 1, 6 }, // 2*1 + 6 = 8
};
double[] outputs = // f(x, y)
{
1, 11, 8, 6, 13, 14, 20, 8
};
// Create the sequential minimal optimization teacher
var learn = new SequentialMinimalOptimizationRegression<Polynomial>()
{
Kernel = new Polynomial(degree: 2)
}
// Use the teacher to learn a new machine
var svm = teacher.Learn(inputs, outputs);
// Compute the answer for one particular example
double fxy = machine.Transform(inputs[0]); // 1.0003849827673186
// Compute the answer for all examples
double[] fxys = machine.Transform(inputs);
这篇关于使用C#和"Accord.NET"进行非线性支持向量回归.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!