ML04 Accord 调用实现机器算法的套路

Posted 石头跑步机

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ML04 Accord 调用实现机器算法的套路相关的知识,希望对你有一定的参考价值。

调用Accord 算法的套路:

第一步:创建一个算法

var teacher = new xxx()

第二步: 训练这个算法

teacher.Learn(input, output)

第三步:让这个算法去预测

teacher.Decide(input)

Case00

// Create the learning algorithm with the chosen kernel
var smo = new SequentialMinimalOptimization<Gaussian>()
{
    Complexity = 100 // Create a hard-margin SVM 
};

// Use the algorithm to learn the svm
var svm = smo.Learn(inputs, outputs);

// Compute the machine‘s answers for the given inputs
bool[] prediction = svm.Decide(inputs);

Case01:

// Create a Naive Bayes learning algorithm
var teacher = new NaiveBayesLearning<NormalDistribution>();

// Use the learning algorithm to learn
var nb = teacher.Learn(inputs, outputs);

// Classify the samples using the model
int[] answers = nb.Decide(inputs);

Case02

var teacher = new LinearCoordinateDescent();

// Teach the vector machine
var svm = teacher.Learn(inputs, outputs);

// Classify the samples using the model
bool[] answers = svm.Decide(inputs);

Case03

// Create a new Sequential Minimal Optimization (SMO) learning 
// algorithm and estimate the complexity parameter C from data
var teacher = new SequentialMinimalOptimization<Gaussian>()
{
         UseComplexityHeuristic = true,
         UseKernelEstimation = true // estimate the kernel from the data
};

// Teach the vector machine
var svm = teacher.Learn(inputs, outputs);

// Classify the samples using the model
bool[] answers = svm.Decide(inputs);

 

以上是关于ML04 Accord 调用实现机器算法的套路的主要内容,如果未能解决你的问题,请参考以下文章

无法使用 Accord.Net 框架实现基本决策树

M03 利用Accord 进行机器学习的第一个小例子

怎样理解神经网络的反向传播算法-ML Note 53

ML机器学习|KMeans聚类算法|EM算法

史上最强:numpy 实现全部机器学习算法

机器学习套路:朴素贝叶斯