Skip to content

Do not pass validation set and metrics callback to Image Classification API. - #4430

Merged
codemzs merged 2 commits into
dotnet:masterfrom
codemzs:automl
Nov 1, 2019
Merged

Do not pass validation set and metrics callback to Image Classification API.#4430
codemzs merged 2 commits into
dotnet:masterfrom
codemzs:automl

Conversation

@codemzs

@codemzs codemzs commented Nov 1, 2019

Copy link
Copy Markdown
Member

No description provided.

@codemzs
codemzs requested a review from justinormont November 1, 2019 20:46
@codemzs
codemzs requested a review from a team as a code owner November 1, 2019 20:46
ColumnInformation columnInfo, IDataView validationSet)
{
var options = TrainerExtensionUtil.CreateOptions<Options>(null, columnInfo.LabelColumnName);
options.ValidationSet = validationSet;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you also passing the validation dataset during CodeGen? If so, it should be removed there too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, I'm not passing validations set at codegen.

@codemzs codemzs changed the title Do not pass validation set to Image Classification API. Do not pass validation set and metrics callback to Image Classification API. Nov 1, 2019
ColumnInformation columnInfo, IDataView validationSet)
{
var options = TrainerExtensionUtil.CreateOptions<Options>(null, columnInfo.LabelColumnName);
options.ValidationSet = validationSet;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please file a tracking issue for cleaning up the other code, and enabling early stopping.

We should discuss how to get early stopping alive. It will be useful.

Remaining issues:

  1. Wrong dataset split -- Current code is using test data during the training process
    To fix: must split off the training dataset instead
  2. Incorrect featurization -- Currently the code incorrectly creates a featurized dataset split -- the classes won't align in various cases giving an incorrect calculation of accuracy within DNNImageClassifier
    To fix: we don't know yet; bit hard to get right
  3. Code elegance -- Current code is punching a hole through ~20 functions to pass down the dataset split. I think there's a more elegant method
  4. CodeGen -- The CodeGen currently doesn't accept a dataset split for its EarlyStopping/etc; CodeGen should be able to recreate the same model

This current PR is a small work around for (1) and (2) by simply not passing the dataset. We should more fully address them in a follow-up.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For 1 and 2, it is up to the caller to pass the right dataset, there is no issue in the ImageClassification API by itself. Right now Image Classification in AutoML is enabled with default parameters and sweeping is DISABLED, the reason being, even without sweeping it can give you good results, we have actually ran more than 50 benchmark to make this claim. I will be happy to discuss in person why I disagree with most of your comment but will open an issue for clean up.

@justinormont justinormont Nov 1, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

... there is no issue in the ImageClassification API by itself.

This is specifically addressing the DNNImageClassifier use in AutoML.

var options = TrainerExtensionUtil.CreateOptions<Options>(null, columnInfo.LabelColumnName);
options.ValidationSet = validationSet;
var logger = ((IChannelProvider)mlContext).Start(nameof(ImageClassificationExtension));
options.MetricsCallback = (ImageClassificationMetrics metric) => { logger.Trace(metric.ToString()); } ;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the future, we should work out how to get status updates all the way to Model Builder and the CLI.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are already getting the status updates. Image Classification API by default plumbs status updates to MLCONTEXT.LOG. The caller needs to read from there.,

@justinormont justinormont left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM; if you haven't please add a tracking issue for the items listed in #4430 (comment)

@codemzs
codemzs merged commit cc0b786 into dotnet:master Nov 1, 2019
frank-dong-ms-zz pushed a commit to frank-dong-ms-zz/machinelearning that referenced this pull request Nov 4, 2019
…on API. (dotnet#4430)

* Do not pass validation set to Image Classification API.

* remove metric callback since it is set to default in ImageClassification Trainer.
frank-dong-ms-zz pushed a commit to frank-dong-ms-zz/machinelearning that referenced this pull request Nov 4, 2019
…on API. (dotnet#4430)

* Do not pass validation set to Image Classification API.

* remove metric callback since it is set to default in ImageClassification Trainer.

resolve conflict

clean up code
@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants