-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Update SentimentAnalysis tutorial to 1.0-preview #11816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update SentimentAnalysis tutorial to 1.0-preview #11816
Conversation
natke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some general comments:
- the Build and Train Model section doesn't actually build and train the model - it more sets up skeleton functions
- In the closing para, you mentioned hyper-parameters but we've not defined these yet
- There is some confusion between the machine learning task and the algorithm to choose for that task. (And I know we don't provide good guidance on that rn). It would be good to clarify this, even if we remain a little vague about why we chose the Scda algorithm.
- I'm not sure we need to save and re-load the model in every single tutorial. This seems like an operational feature that developers could learn about from our How-to on the topic.
| "Is it A or B?" | ||
|
|
||
| Add the following code to the `BuildAndTrainModel` method: | ||
|  |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we put in an art request to get this artified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Can we leave it for now in the meantime and replace later?
| [!code-csharp[TrainModel](~/samples/machine-learning/tutorials/SentimentAnalysis/Program.cs#TrainModel "Train the model")] | ||
|
|
||
| ### Save and Return the model trained to use for evaluation | ||
| The [Fit()](xref:Microsoft.ML.Trainers.MatrixFactorizationTrainer.Fit%28Microsoft.ML.IDataView,Microsoft.ML.IDataView%29) method trains your model with the provided training dataset. It executes the `Estimator` definitions by transforming the data and applying the training, and it returns back the trained model, which is a `Transformer`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest: The Fit() method uses the training data to calculate the parameters of the model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure that is clearer. Made an edit. What do you think?
…r/docs into jralexander-041119-01 Resyncing
luisquintanilla
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good. Minor changes.
| |Wow... Loved this place. | 1 | | ||
| |Service was very prompt. | 1 | | ||
|
|
||
| `SentimentPrediction` is the prediction class used after the model training. It has a single boolean (`Sentiment`) and a `PredictedLabel` `ColumnName` attribute. The `Label` is used to create and train the model, and it's also used with the split out test dataset to evaluate the model. The `PredictedLabel` is used during prediction and evaluation. For evaluation, training data, the predicted values, and the model are used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Add xref to ColumnName.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its xreffed in the previous paragraph.
| Add the following code to the `BuildAndTrainModel` method: | ||
| ## Train the model | ||
|
|
||
| Fit the model to the `Train` data and return the trained model by adding the following as the next line of code in the `BuildAndTrainModel()` method: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if Train needs to be inlined.
natke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor comment. Other than that LGTM!
|
|
||
| [!code-csharp[Predict](~/samples/machine-learning/tutorials/SentimentAnalysis/Program.cs#Predict "Create a prediction of sentiment")] | ||
|
|
||
| The [Predict()](xref:Microsoft.ML.PredictionEngine%602.Predict%2A) function makes a prediction on a single column of data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
column -> row
|
Thanks, @luisquintanilla and @natke!! |
Internal Review URL
Fixes #11859
Fixes #11779
Code here: dotnet/samples#81