[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 <srowen@gmail.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
This commit is contained in:
parent
1a9722420e
commit
2f30cdebb1
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue