Как закодировать параметр регрессии SVM на Accord. NET как SKlearn - PullRequest
0 голосов
/ 12 июля 2020

Я создал несколько моделей на Sklearn в python. в результате у меня есть некоторые параметры для каждой модели с SVR as gamma, C, degree.

{'C': 14008.699090460115,
 'degree': 1.5614840051214403,
 'gamma': 0.9313027879935729,
 'kernel': 'poly'}

{'C': 74.699090460115,
     'kernel': 'linear'}

{'C': 452.699090460115,
     'degree': 1.5614840051214403,
     'gamma': 0.9313027879935729,
     'kernel': 'rbf'}

Я использую версию 3.8 по соглашению. NET и использую официальная документация

Вопрос в том, как установить эти параметры gamma, C и degree на моей модели Accord. NET?

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
};

double[] outputs = // f(x, y)
{
    1, 11, 8, 6, 13
};

// Create the sequential minimal optimization teacher
var learn = new SequentialMinimalOptimizationRegression<Polynomial>()
{
    Kernel = new Polynomial(2), // Polynomial Kernel of 2nd degree
    Complexity = 100
};

// Run the learning algorithm
SupportVectorMachine<Polynomial> svm = learn.Learn(inputs, outputs);

// Compute the predicted scores
double[] predicted = svm.Score(inputs);

// Compute the error between the expected and predicted
double error = new SquareLoss(outputs).Loss(predicted);

// Compute the answer for one particular example
double fxy = svm.Score(inputs[0]); // 1.0003849827673186
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...