Machinelearning: ML.NET public API exposes parameter `weights` which is not used.

Created on 17 Jan 2019  路  6Comments  路  Source: dotnet/machinelearning

For some of the learners e.g. SdcaRegression ML.NET public API exposes parameter weights

https://github.com/dotnet/machinelearning/blob/cabf55b543129e8962ba716e8e22c72ac08773e3/src/Microsoft.ML.StandardLearners/StandardLearnersCatalog.cs#L65-L70

However, the advanced Options for SdcaRegressionTrainer do not have a field for 'WeightColumn'. Also, I believe the algo itself does not use weights (need to verify)

We need to scrub our public API for such spurious uses of weights parameter.

EDIT :

  • Based on investigations (see below), we see that the SdcaRegressionTrainer does use the weights column. So the proper fix would be to ensure that the weight column passed in the constructor gets used by the trainer.
  • For the example above, we need to add WeightColumn in the advanced Options for SdcaRegressionTrainer and verify it gets used by the SDCA trainer.

@sfilipi @glebuk @TomFinley

bug

Most helpful comment

There are several additional problems with weigh parameters::

  • Name of the argument should be consistent with outer column names, it should end on *Column.
  • method should only have the parameter when algo uses it.
  • the term "weight" is ambigious with model weights. Perhaps we should disambiguate this further by calling it exampleWeightColumn
  • Confusing behavior between providing input values null and "weight":
  • if arg is not specified and Weight column exists - column is used
  • if arg is not specified and Weight column does NOT exist - no error
  • if arg is specified and Weight column exist - column is used
  • if arg is specified and Weight column does NOT exist - crash!

This comes from the command line days. However it does not make much sense from the API point of veiw.

All 6 comments

There are several additional problems with weigh parameters::

  • Name of the argument should be consistent with outer column names, it should end on *Column.
  • method should only have the parameter when algo uses it.
  • the term "weight" is ambigious with model weights. Perhaps we should disambiguate this further by calling it exampleWeightColumn
  • Confusing behavior between providing input values null and "weight":
  • if arg is not specified and Weight column exists - column is used
  • if arg is not specified and Weight column does NOT exist - no error
  • if arg is specified and Weight column exist - column is used
  • if arg is specified and Weight column does NOT exist - crash!

This comes from the command line days. However it does not make much sense from the API point of veiw.

seems related to issue #2177

However, the advanced Options for SdcaRegressionTrainer do not have a field for 'WeightColumn'. Also, I believe the algo itself does not use weights (need to verify)

Hi @abgoswam ... from what I see, it does. See here, in the SdcaTrainerBase.TrainCore method:

https://github.com/dotnet/machinelearning/blob/3e03fcef46e0bdd6961e0cccb7cc490ab535fbaf/src/Microsoft.ML.StandardLearners/Standard/SdcaBinary.cs#L556

If the "connection" from weights in the constructor to weights in the trainer has been broken, that is what must be fixed. You should not remove the option -- you should make it work, right? At least so I would think.

@TomFinley . Correct. As you pointed out, for this issue we need a fix whereby the weight column passed in the constructor gets used by the trainer.

I have edited the bug description accordingly.

@glebuk . I created a separate issue #2257 for the 2 comments above regarding naming convention for the weights parameter

  • Name of the argument should be consistent with outer column names, it should end on *Column.
  • The term "weight" is ambigious with model weights. Perhaps we should disambiguate this further by calling it exampleWeightColumn

Removing api label, added bug label. Hence removing it from Project13 as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OneCyrus picture OneCyrus  路  4Comments

daholste picture daholste  路  3Comments

sfilipi picture sfilipi  路  4Comments

aslotte picture aslotte  路  3Comments

sethreidnz picture sethreidnz  路  3Comments