【问题标题】:Non-linear Support Vector Regression with C# and "Accord.NET"使用 C# 和“Accord.NET”的非线性支持向量回归
【发布时间】:2015-04-16 19:42:36
【问题描述】:

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

【问题讨论】:

    标签: c# machine-learning accord.net non-linear-regression


    【解决方案1】:

    Accord.NET 为 SequentialMinimalOptimizationRegression 类中的回归问题提供了支持向量机学习算法。有一个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); 
    

    【讨论】:

    • 谢谢!我一开始就这样做了,但不确定我是否在进行回归.... dum
    猜你喜欢
    • 1970-01-01
    • 2014-07-03
    • 2020-01-18
    • 2017-09-19
    • 2013-08-21
    • 2018-12-23
    • 1970-01-01
    • 1970-01-01
    • 2021-05-07
    相关资源
    最近更新 更多