Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides ML.NET integration in .NET apps, covering model training, evaluation, inference pipelines, loading, and deployment review.
86% 91%+5 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 19 of 22 without it.
3 of 3 safety checks passed
This reference provides complete examples for common machine learning scenarios using ML.NET.
Binary classification for detecting positive or negative sentiment in text.
public class SentimentData(string Text, bool Sentiment)
{
[LoadColumn(0)]
public string Text { get; } = Text;
[LoadColumn(1), ColumnName("Label")]
public bool Sentiment { get; } = Sentiment;
}
public class SentimentPrediction
{
[ColumnName("PredictedLabel")]
public bool Prediction { get; set; }
public float Probability { get; set; }
public float Score { get; set; }
}
public class SentimentAnalysisService(MLContext mlContext)
{
public ITransformer TrainModel(string dataPath)
{
var data = mlContext.Data.LoadFromTextFile<SentimentData>(
dataPath,
hasHeader: true,
separatorChar: '\t');
var split = mlContext.Data.TrainTestSplit(data, testFraction: 0.2);
var pipeline = mlContext.Transforms.Text
Next to this one in the catalogue, plus more from the same author.