机器学习框架ML.NET学习笔记【4】多元分类之手写数字识别
一、问题与解决方案 通过多元分类算法进行手写数字识别,手写数字的图片分辨率为8*8的灰度图片、已经预先进行过处理,读取了各像素点的灰度值,并进行了标记。 其中第0列是序号(不参与运算)、1-64列是像素值、65列是结果。 我们以64位像素值为特征进行多元分类,算法采用SDCA最大熵分类算法。 二、源码 先贴出全部代码: namespace MulticlassClassification_Mnist { class Program { static readonly string TrainDataPath = Path.Combine(Environment.CurrentDirectory, " Data " , " optdigits-full.csv " ); static readonly string ModelPath = Path.Combine(Environment.CurrentDirectory, " Data " , " SDCA-Model.zip " ); static void Main( string [] args) { MLContext mlContext = new MLContext(seed: 1 ); TrainAndSaveModel(mlContext); TestSomePredictions(mlContext);