You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by jk...@apache.org on 2016/04/26 21:01:01 UTC
spark git commit: [SPARK-14903][SPARK-14071][ML][PYTHON] Revert :
MLWritable.write property
Repository: spark
Updated Branches:
refs/heads/master 302a18686 -> 89f082de0
[SPARK-14903][SPARK-14071][ML][PYTHON] Revert : MLWritable.write property
## What changes were proposed in this pull request?
SPARK-14071 changed MLWritable.write to be a property. This reverts that change since there was not a good way to make MLReadable.read appear to be a property.
## How was this patch tested?
existing unit tests
Author: Joseph K. Bradley <jo...@databricks.com>
Closes #12671 from jkbradley/revert-MLWritable-write-py.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/89f082de
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/89f082de
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/89f082de
Branch: refs/heads/master
Commit: 89f082de0e2358ef8352deddcec5f8cc714f4721
Parents: 302a186
Author: Joseph K. Bradley <jo...@databricks.com>
Authored: Tue Apr 26 12:00:57 2016 -0700
Committer: Joseph K. Bradley <jo...@databricks.com>
Committed: Tue Apr 26 12:00:57 2016 -0700
----------------------------------------------------------------------
python/pyspark/ml/tests.py | 5 -----
python/pyspark/ml/util.py | 4 +---
2 files changed, 1 insertion(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/89f082de/python/pyspark/ml/tests.py
----------------------------------------------------------------------
diff --git a/python/pyspark/ml/tests.py b/python/pyspark/ml/tests.py
index 8954e96..d014da8 100644
--- a/python/pyspark/ml/tests.py
+++ b/python/pyspark/ml/tests.py
@@ -53,7 +53,6 @@ from pyspark.ml.param import Param, Params, TypeConverters
from pyspark.ml.param.shared import HasMaxIter, HasInputCol, HasSeed
from pyspark.ml.regression import LinearRegression, DecisionTreeRegressor
from pyspark.ml.tuning import *
-from pyspark.ml.util import MLWritable, MLWriter
from pyspark.ml.wrapper import JavaParams
from pyspark.mllib.linalg import Vectors, DenseVector, SparseVector
from pyspark.sql import DataFrame, SQLContext, Row
@@ -746,10 +745,6 @@ class PersistenceTest(PySparkTestCase):
except OSError:
pass
- def test_write_property(self):
- lr = LinearRegression(maxIter=1)
- self.assertTrue(isinstance(lr.write, MLWriter))
-
def test_decisiontree_classifier(self):
dt = DecisionTreeClassifier(maxDepth=1)
path = tempfile.mkdtemp()
http://git-wip-us.apache.org/repos/asf/spark/blob/89f082de/python/pyspark/ml/util.py
----------------------------------------------------------------------
diff --git a/python/pyspark/ml/util.py b/python/pyspark/ml/util.py
index dc3914f..9d28823 100644
--- a/python/pyspark/ml/util.py
+++ b/python/pyspark/ml/util.py
@@ -120,14 +120,13 @@ class MLWritable(object):
.. versionadded:: 2.0.0
"""
- @property
def write(self):
"""Returns an MLWriter instance for this ML instance."""
raise NotImplementedError("MLWritable is not yet implemented for type: %r" % type(self))
def save(self, path):
"""Save this ML instance to the given path, a shortcut of `write().save(path)`."""
- self.write.save(path)
+ self.write().save(path)
@inherit_doc
@@ -136,7 +135,6 @@ class JavaMLWritable(MLWritable):
(Private) Mixin for ML instances that provide :py:class:`JavaMLWriter`.
"""
- @property
def write(self):
"""Returns an MLWriter instance for this ML instance."""
return JavaMLWriter(self)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org