dotnet / dotnet/machinelearning-modelbuilder

ML.NET Tutorial - Sentiment Prediction Sample Code

Open
#2,909 0 comments 0 reactions 0 assignees View on GitHub
GS Tutorial
Dominant language
Dockerfile
Stars
285
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have tried your tutorial to developed my first AI Model using your tutorial with link below, it is an AI sample for sentiment Analysis.

All the Steps worked fine and i am able to create a model successfully but when i tried consuming this model as per instruction it ran but its giving response in opposite. like my below code it should give me positve sentiment but it is output as Negative that is wrong.

Tutorial Link:
https://dotnet.microsoft.com/en-us/learn/ml-dotnet/get-started-tutorial/intro

The sample code for Reference:
`var sampleData = new SentimentMLModel.ModelInput()
{
Col0 = "This restaurant was wonderful."
};

//Load model and predict output
var result = SentimentMLModel.Predict(sampleData);
// If Prediction is 1, sentiment is "Positive"; otherwise, sentiment is "Negative"
var sentiment = result.PredictedLabel == 1 ? "Positive" : "Negative";

Console.WriteLine($"Text: {sampleData.Col0}\nSentiment: {sentiment}");`

The Output:
"Sentiment: Negative"

![Sentiment](https://github.com/dotnet/machinelearning-modelbuilder/assets/6714943/a2023560-892c-45f8-ae68-aa6a449a2b30)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.