.net随笔-vb.net Accord.Net机器学习之贝叶斯分类

吴西岭
2023-12-01

1、Accord.IO/ExcelReader.cs读取excel文件,源码如下:
https://github.com/accord-net/framework/blob/792015d0e2ee250228dfafb99ea0e84d031a29ae/Sources/Accord.IO/ExcelReader.cs
2、绘制数据

Imports Accord.Controls
Imports Accord.IO
Imports Accord.Math
Imports Accord.Statistics.Distributions.Univariate
Imports Accord.MachineLearning.Bayes
Imports System





Public Class Form1
    '贝叶斯分类
    '使用Accord.IO里的的excel读取类
    Dim table As DataTable = New ExcelReader("E:\pro\books\AI_.net\src\AI_learn\learnai-1\data\examples.xls").GetWorksheet("Classification - Yin Yang")
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        '读取样本
        ' 转换datatable为输入输出数组
        Dim inputs As Double()() = table.ToJagged(Of Double)("X", "Y")
        Dim outputs As Integer() = table.Columns("G").ToArray(Of Integer)()
        '绘制数据
        ScatterplotBox.Show("样本数据", i
 类似资料: