Skip to content

[SPARK-25090][ML] Enforce implicit type coercion in ParamGridBuilder#22076

Closed
mgaido91 wants to merge 2 commits intoapache:masterfrom
mgaido91:SPARK-25090
Closed

[SPARK-25090][ML] Enforce implicit type coercion in ParamGridBuilder#22076
mgaido91 wants to merge 2 commits intoapache:masterfrom
mgaido91:SPARK-25090

Conversation

@mgaido91
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

When the grid of the parameters is created in ParamGridBuilder, the implicit type coercion is not enforced. So using an integer in the list of parameters to set for a parameter accepting a double can cause a class cast exception.

The PR proposes to enforce the type coercion when building the parameters.

How was this patch tested?

added UT

@SparkQA
Copy link
Copy Markdown

SparkQA commented Aug 11, 2018

Test build #94609 has finished for PR 22076 at commit b5a59fd.

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

@mgaido91
Copy link
Copy Markdown
Contributor Author

paramGrid = ParamGridBuilder().addGrid(lr.regParam, [0.5, 1]).build()
for param in paramGrid:
for v in param.values():
assert(type(v) is float)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: type(v) == float

@SparkQA
Copy link
Copy Markdown

SparkQA commented Aug 12, 2018

Test build #94647 has finished for PR 22076 at commit 1727bf0.

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

@viirya
Copy link
Copy Markdown
Member

viirya commented Aug 12, 2018

LGTM

@HyukjinKwon
Copy link
Copy Markdown
Member

Merged to master.

@asfgit asfgit closed this in 20fa456 Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants