Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/10469#discussion_r49408892
--- Diff: python/pyspark/ml/regression.py ---
@@ -68,6 +69,28 @@ class LinearRegression(JavaEstimator, HasFeaturesCol,
HasLabelCol, HasPrediction
Traceback (most recent call last):
...
TypeError: Method setParams forces keyword arguments.
+ >>> import os, tempfile
+ >>> path = tempfile.mkdtemp()
+ >>> lr_path = path + "/lr"
+ >>> lr.save(lr_path)
+ >>> lr2 = LinearRegression.load(lr_path)
+ >>> model2 = lr2.fit(df)
+ >>> abs(model.coefficients[0] - model2.coefficients[0]) < 0.001
+ True
+ >>> abs(model.intercept - model2.intercept) < 0.001
+ True
+ >>> model_path = path + "/model"
+ >>> model.save(model_path)
+ >>> model3 = LinearRegressionModel.load(model_path)
+ >>> abs(model.coefficients[0] - model3.coefficients[0]) < 0.001
--- End diff --
Test for exact equality here & in the next line
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]