Skip to content
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

[SPARK-29377][PYTHON][ML] Parity between Scala ML tuning and Python ML tuning #26057

Closed
wants to merge 2 commits into from

Conversation

huaxingao
Copy link
Contributor

What changes were proposed in this pull request?

Follow Scala ml tuning implementation

  • put leading underscore before python ValidatorParams to indicate private
  • add _CrossValidatorParams and _TrainValidationSplitParams
  • separate the getters and setters. Put getters in _XXXParams and setters in the Classes.

Why are the changes needed?

Keep parity between scala and python

Does this PR introduce any user-facing change?

add CrossValidatorModel.getNumFolds and TrainValidationSplitModel.getTrainRatio()

How was this patch tested?

Add doctest

@SparkQA
Copy link

SparkQA commented Oct 8, 2019

Test build #111911 has finished for PR 26057 at commit 8a5615b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • class _ValidatorParams(HasSeed):
  • class _CrossValidatorParams(_ValidatorParams):
  • class CrossValidator(Estimator, _CrossValidatorParams, HasParallelism, HasCollectSubModels,
  • class CrossValidatorModel(Model, _CrossValidatorParams, MLReadable, MLWritable):
  • class _TrainValidationSplitParams(_ValidatorParams):
  • class TrainValidationSplit(Estimator, _TrainValidationSplitParams, HasParallelism,
  • class TrainValidationSplitModel(Model, _TrainValidationSplitParams, MLReadable, MLWritable):

@@ -199,7 +181,25 @@ def _to_java_impl(self):
return java_estimator, java_epms, java_evaluator


class CrossValidator(Estimator, ValidatorParams, HasParallelism, HasCollectSubModels,
class _CrossValidatorParams(_ValidatorParams):
Copy link
Member

Choose a reason for hiding this comment

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

Will these changes affect users who try to extend these classes much or at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think adding leading underscore will affect users to extend these classes. The single leading underscore before a class name is only a weak indicator for internal usage. It doesn't enforce privacy.

@zhengruifeng
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Oct 12, 2019

Test build #111974 has finished for PR 26057 at commit 8a5615b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • class _ValidatorParams(HasSeed):
  • class _CrossValidatorParams(_ValidatorParams):
  • class CrossValidator(Estimator, _CrossValidatorParams, HasParallelism, HasCollectSubModels,
  • class CrossValidatorModel(Model, _CrossValidatorParams, MLReadable, MLWritable):
  • class _TrainValidationSplitParams(_ValidatorParams):
  • class TrainValidationSplit(Estimator, _TrainValidationSplitParams, HasParallelism,
  • class TrainValidationSplitModel(Model, _TrainValidationSplitParams, MLReadable, MLWritable):

"""
return self._set(estimatorParamMaps=value)

def setEvaluator(self, value):
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to add since for setters? Some like setNumFolds have it, but some do not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the original file has @SInCE, I have it too. Some of the getters/setters don't have @SInCE in the original file, so I don't have i too.
I will check the history to find out which release starts to have these getters/setters, and add @SInCE for each of the getters/setters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked the history, the @since was removed in #12020. I guess the reason is that in CrossValidator, the getters/getters have @since 1.4, but in TrainValidationSplit, the getters/getters have @since 2.0. When putting the common getters/setters in ValidatorParams, neither @since 1.4 nor @since 2.0 is quite right, so @since was removed. I am facing the same problem. Shall I have @since 2.0? or just not adding back the @since?

Copy link
Member

Choose a reason for hiding this comment

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

@since 2.0 is at least accurate, as both have existed since that version. One existed before, sure, but this is maybe not a big deal, as it won't matter much at all to know it was in 1.x.

@SparkQA
Copy link

SparkQA commented Oct 13, 2019

Test build #112000 has finished for PR 26057 at commit 2a23e08.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@zhengruifeng
Copy link
Contributor

merged to master, thanks all

@huaxingao
Copy link
Contributor Author

@zhengruifeng @viirya @srowen Thanks all for your help!

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.

6 participants