gpt4 book ai didi

c# - 使用 C# 和 "Accord.NET"进行非线性支持向量回归

转载 作者:行者123 更新时间:2023-11-30 21:59:00 26 4
gpt4 key购买 nike

在 Accord 中使用 C# 进行非线性向量回归应该使用什么?谢谢(traininginputs double[][] and trainingoutput double[] NOT int[])

最佳答案

Accord.NET 为 SequentialMinimalOptimizationRegression 中的回归问题提供支持向量机学习算法。类(class)。有一个 example application for this topic in the sample application's wiki page .

下面是一个如何使用它的例子:

// 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# - 使用 C# 和 "Accord.NET"进行非线性支持向量回归,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29684519/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com