项目详情
由
分享


HelloGitHub 评分
0 人评分
开源•MIT
认领
讨论
收藏
分享
9.3k
星数
否
中文
C#
主语言
是
活跃
229
贡献者
991
Issues
是
组织
4.0.2
最新版本
2k
Forks
MIT
协议
更多
微软开源的 C# 机器学习框架。支持的机器学习类任务:分类、回归、聚类等,[教程和视频](https://dotnet.microsoft.com/learn/ml-dotnet)。示例代码:
```C
var dataPath = "sentiment.csv";
var mlContext = new MLContext();
var loader = mlContext.Data.CreateTextLoader(new[]
{
new TextLoader.Column("SentimentText", DataKind.String, 1),
new TextLoader.Column("Label", DataKind.Boolean, 0),
},
hasHeader: true,
separatorChar: ',');
var data = loader.Load(dataPath);
var learningPipeline = mlContext.Transforms.Text.FeaturizeText("Features", "SentimentText")
.Append(mlContext.BinaryClassification.Trainers.FastTree());
var model = learningPipeline.Fit(data);
var predictionEngine = mlContext.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(model);
var prediction = predictionEngine.Predict(new SentimentData
{
SentimentText = "Today is a great day!"
});
Console.WriteLine("prediction: " + prediction.Prediction);
```
收录于:
第 54 期
评论
评分:
暂无精选评论