This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 0ae21c7 [SPARK-34642][DOCS][ML] Fix TypeError in Pyspark Linear
Regression docs
0ae21c7 is described below
commit 0ae21c71b050e8348af792055b93439a6f9fc42b
Author: Sean Owen <[email protected]>
AuthorDate: Sat Mar 6 07:32:01 2021 -0800
[SPARK-34642][DOCS][ML] Fix TypeError in Pyspark Linear Regression docs
### What changes were proposed in this pull request?
Fix a call to setParams in the Linear Regression docs example in Pyspark to
avoid a TypeError.
### Why are the changes needed?
The example is slightly wrong and we should not show an error in the docs.
### Does this PR introduce _any_ user-facing change?
None
### How was this patch tested?
Existing tests
Closes #31760 from srowen/SPARK-34642.
Authored-by: Sean Owen <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 2f30cdebb18488a4ba83dd06aa5c5c7126dd8a8c)
Signed-off-by: Dongjoon Hyun <[email protected]>
---
python/pyspark/ml/regression.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/python/pyspark/ml/regression.py b/python/pyspark/ml/regression.py
index d37654a..ba63de7 100644
--- a/python/pyspark/ml/regression.py
+++ b/python/pyspark/ml/regression.py
@@ -180,10 +180,8 @@ class LinearRegression(_JavaRegressor,
_LinearRegressionParams, JavaMLWritable,
>>> test1 = spark.createDataFrame([(Vectors.sparse(1, [0], [1.0]),)],
["features"])
>>> abs(model.transform(test1).head().newPrediction - 1.0) < 0.001
True
- >>> lr.setParams("vector")
- Traceback (most recent call last):
- ...
- TypeError: Method setParams forces keyword arguments.
+ >>> lr.setParams(featuresCol="vector")
+ LinearRegression...
>>> lr_path = temp_path + "/lr"
>>> lr.save(lr_path)
>>> lr2 = LinearRegression.load(lr_path)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]