zoukankan      html  css  js  c++  java
  • 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);
  • 相关阅读:
    TestMap HashMap的常见操作
    三种方式遍历一颗二叉树
    jmeter 5.1.1版本 进行抓包的时候弹出输入密码
    浅谈Java中的AOP面向切面的变成和控制反转IOC
    rpc测试框架
    SpringBoot下,@WebFilter配置获取日志
    某些测试工具
    Google的三大马车
    关于Mock的一些网站
    用Jmeter做性能测试,之后报表展示
  • 原文地址:https://www.cnblogs.com/zhixingheyi/p/8111682.html
Copyright © 2011-2022 走看看