ml.net

机器学习框架ML.NET学习笔记【4】多元分类之手写数字识别

拈花ヽ惹草 提交于 2020-05-06 16:47:50
一、问题与解决方案 通过多元分类算法进行手写数字识别,手写数字的图片分辨率为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);

一起了解 .Net Foundation 项目 No.11

徘徊边缘 提交于 2020-03-04 08:18:44
.Net 基金会中包含有很多优秀的项目,今天就和笔者一起了解一下其中的一些优秀作品吧。 中文介绍 中文介绍内容翻译自英文介绍,主要采用意译、如与原文存在出入,请以原文为准。 Microsoft Web Protection Library Microsoft Web Protection Library (WPL) 包含一组用于对 web 站点添加防护的程序集。 它包括有提供的一组编码函数,用于对用户输入的 HTML 、 HTML属性 、 XML 、 CSS 和 JavaScript 进行处理,以达到防 XSS(跨站脚本攻击)的目的。 它还包括 Security Runtime Engine ,其能够为已有的站点添加一层包装,确保常见的攻击无法进入您的应用程序。 项目详情 官方网站 项目源码 许可证类型: Microsoft Public License (Ms-PL) 项目联系人: Barry Dorrans 相关链接 参与讨论 笔者简评 该项目已经停止维护。 这是一个相当古老的项目,当前这个项目的主要内容都已经被合并入了 Framework 4 当中。当然还可以从 nuget 上获取该项目单独的包用于更旧版本的应用程序。 英文介绍 Microsoft Web Protection Library The Microsoft Web Protection Library (WPL

Image recognition/classification using Microsoft ML.net 0.2 (Machine learning)

让人想犯罪 __ 提交于 2020-01-25 04:38:29
问题 I want to do Image recognition/classification using the newly release Microsoft ML.net 0.2 ....is there a code sample available. Does it supports analyzing images & creating models out of it ? 回答1: With ML.NET still being in an early preview, doing anything with unstructured data (images, text, video) is still unavailable. If you look at the roadmap, though, it is planned to include text and image features. As of now, you can only use it for structured, tabular data such as CSVs. 回答2: Accord

How to add model to PredictionEnginePool in middleware (ML.NET)?

痴心易碎 提交于 2020-01-15 14:27:28
问题 I'm using ML.NET in an ASP.NET Core application, and I am using the following code in Startup : var builder = services.AddPredictionEnginePool<Foo, Bar>(); if (File.Exists("model.zip")) { builder.FromFile(String.Empty, "model.zip", true); } If model.zip doesn't exist, I create it later in the middleware. How do I add it to the PredictionEnginePool that is injected? There are no options to load a model via PredictionEnginePool , and instantiating or injecting a PredictionEnginePoolBuilder isn

How to add model to PredictionEnginePool in middleware (ML.NET)?

核能气质少年 提交于 2020-01-15 14:25:11
问题 I'm using ML.NET in an ASP.NET Core application, and I am using the following code in Startup : var builder = services.AddPredictionEnginePool<Foo, Bar>(); if (File.Exists("model.zip")) { builder.FromFile(String.Empty, "model.zip", true); } If model.zip doesn't exist, I create it later in the middleware. How do I add it to the PredictionEnginePool that is injected? There are no options to load a model via PredictionEnginePool , and instantiating or injecting a PredictionEnginePoolBuilder isn

ML .net reading in tab seperated data set

大兔子大兔子 提交于 2020-01-14 04:26:23
问题 Its my first time using ML.net 0.8 and I'm having troubling loading in my dataset. var mlContext = new MLContext(); String dataPath = "ML Data 3.txt"; var trainingDataView = mlContext.Data.ReadFromTextFile( columns: new TextLoader.Column[] { new TextLoader.Column("Product", DataKind.Text,0), new TextLoader.Column("Streat", DataKind.R4, 1), new TextLoader.Column("Overspray", DataKind.R4,2), new TextLoader.Column("MLS",DataKind.R4,3), new TextLoader.Column("Moisture",DataKind.R4,4) }, path:

How to predict multiple labels with ML.NET using regression task?

旧巷老猫 提交于 2020-01-11 10:25:08
问题 I'm very new to machine learning and I've stumbled upon the following problem. Considering an official NYC Taxi fare amount prediction tutorial, let's say I'd like to predict another real value, e.g. TripTime . I've modified my code as follows: public class TripFarePrediction // this class is used to store prediction result { [ColumnName("Score")] public float FareAmount { get; set; } [ColumnName("Score2")] public float TripTime { get; set; } } private static ITransformer Train(MLContext

Specify columns as both feature and label in multiple combined regression models (ML.NET)

倾然丶 夕夏残阳落幕 提交于 2019-12-25 01:24:37
问题 I'm using ML.NET to predict a series of values using a regression model. I am only interested in one column being predicted (the score column). However, the values of some of the other columns are not available for the prediction class. I can't leave them at 0 as this would upset the prediction, so I guess they would have to also be predicted. I saw a similar question here on predicting multiple values. The answer suggests creating two models, but I can see that the feature columns specified

Am I using TextLoader wrong when running the ML.Net Iris demo in F#?

此生再无相见时 提交于 2019-12-23 10:57:15
问题 I am new to F#/.NET and I am trying to run the F# example provided in the accepted answer of How to translate the intro ML.Net demo to F#? with the ML.NET library, using F# on Visual Studio, using Microsoft.ML (0.2.0). When building it I get the error error FS0039: The type 'TextLoader' is not defined. To avoid this, I added the line open Microsoft.ML.Data to the source. Then, however, the line pipeline.Add(new TextLoader<IrisData>(dataPath,separator = ",")) triggers: error FS0033: The non

How to translate the intro ML.Net demo to F#?

大城市里の小女人 提交于 2019-12-19 05:49:30
问题 I'm looking at a the cs file here: https://www.microsoft.com/net/learn/apps/machine-learning-and-ai/ml-dotnet/get-started/windows and in my attempt to translate it to F# it compiles just fine but throws a System.Reflection.TargetInvocationException when run: FormatException: One of the identified items was in an invalid format . What am I missing? Editted: Was using records before open Microsoft.ML open Microsoft.ML.Runtime.Api open Microsoft.ML.Trainers open Microsoft.ML.Transforms open