[GitHub] spark pull request #22076: [SPARK-25090][ML] Enforce implicit type coercion ...

2018-08-12 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/22076


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #22076: [SPARK-25090][ML] Enforce implicit type coercion ...

2018-08-12 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/22076#discussion_r209454605
  
--- Diff: python/pyspark/ml/tests.py ---
@@ -950,6 +950,13 @@ def test_fit_maximize_metric(self):
  "Best model should have zero induced error")
 self.assertEqual(1.0, bestModelMetric, "Best model has R-squared 
of 1")
 
+def test_param_grid_type_coercion(self):
+lr = LogisticRegression(maxIter=10)
+paramGrid = ParamGridBuilder().addGrid(lr.regParam, [0.5, 
1]).build()
+for param in paramGrid:
+for v in param.values():
+assert(type(v) is float)
--- End diff --

nit: `type(v) == float `


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #22076: [SPARK-25090][ML] Enforce implicit type coercion ...

2018-08-11 Thread mgaido91
GitHub user mgaido91 opened a pull request:

https://github.com/apache/spark/pull/22076

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

## 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

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mgaido91/spark SPARK-25090

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/22076.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #22076


commit b5a59fdc71226323008561053cf918e079934f0a
Author: Marco Gaido 
Date:   2018-08-11T10:07:31Z

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




---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org