打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
C# 机器学习实战SVM多分类

1:先用一下  Accord.MachineLearning(在NuGet下载即可)

2:引用

using Accord.MachineLearning.VectorMachines.Learning;
using Accord.Statistics.Kernels;

3:实例SVM多分类

Code:

double[][] inputs =
            {
                new double[] { 0 },
                new double[] { 3 },
                new double[] { 1 },
                new double[] { 2 },
            };
            double[][] inputsTest =
            {
                new double[] { 4 },
            };

            // Outputs for each of the inputs
            int[] outputs =
            {
                0,
                3,
                1,
                2,
            };
            // Create the Multi-label learning algorithm for the machine
            var teacher = new MulticlassSupportVectorLearning<Linear>()
            {
                Learner = (p) => new SequentialMinimalOptimization<Linear>()
                {
                    Complexity = 10000.0 // Create a hard SVM
                }
            };
            // Learn a multi-label SVM using the teacher
            var svm = teacher.Learn(inputs, outputs);
            // Compute the machine answers for the inputs
            int[] answers = svm.Decide(inputsTest);
            Console.WriteLine(answers[0]);
            Console.ReadKey();

github网址:    https://github.com/accord-net/framework/wiki/Classification


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
如何利用 C# 实现 K 最邻近算法?
在C#语言中实现简单神经网络(使用面向对象编程和C#从头开始构建神经网络)
2014年秋新人教版九年级英语单元1教案
感知器实现或(or) Python版
二级流水线8位加法器
《Learn SVM Step by Step》by faruto2011系列视频
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服