Skip to content

Conversation

@JRAlexander
Copy link
Contributor

@JRAlexander JRAlexander commented Apr 12, 2019

@JRAlexander JRAlexander changed the title [WIP] Update SentimentAnalysis tutorial Update SentimentAnalysis tutorial to 1.0-preview Apr 15, 2019
@JRAlexander JRAlexander added this to the April 2019 milestone Apr 15, 2019
Copy link
Contributor

@natke natke left a 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:
![classification machine learning algorithm](./media/sentiment-analysis/classification.png)
Copy link
Contributor

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?

Copy link
Contributor Author

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`.
Copy link
Contributor

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.

Copy link
Contributor Author

@JRAlexander JRAlexander Apr 16, 2019

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?

Copy link
Contributor

@luisquintanilla luisquintanilla left a 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.
Copy link
Contributor

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.

Copy link
Contributor Author

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:
Copy link
Contributor

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.

Copy link
Contributor

@natke natke left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

column -> row

@JRAlexander
Copy link
Contributor Author

Thanks, @luisquintanilla and @natke!!

@JRAlexander JRAlexander merged commit cd2d599 into dotnet:master Apr 18, 2019
@JRAlexander JRAlexander deleted the jralexander-041119-01 branch April 18, 2019 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tutorial doesn't work in 1.0RC Tutorials document requires an update for ML version 1.0.0-preview

4 participants