aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorvectorijk <jiangkai@gmail.com>2015-11-02 16:12:04 -0800
committerDB Tsai <dbt@netflix.com>2015-11-02 16:12:04 -0800
commitc020f7d9d43548d27ae4a9564ba38981fd530cb1 (patch)
tree8dc46ed1b48d88852323747b2d86aedd1c770b64 /python
parentec03866a7ef2d0826520755d47c8c9480148a76c (diff)
downloadspark-c020f7d9d43548d27ae4a9564ba38981fd530cb1.tar.gz
spark-c020f7d9d43548d27ae4a9564ba38981fd530cb1.tar.bz2
spark-c020f7d9d43548d27ae4a9564ba38981fd530cb1.zip
[SPARK-10592] [ML] [PySpark] Deprecate weights and use coefficients instead in ML models
Deprecated in `LogisticRegression` and `LinearRegression` Author: vectorijk <jiangkai@gmail.com> Closes #9311 from vectorijk/spark-10592.
Diffstat (limited to 'python')
-rw-r--r--python/pyspark/ml/classification.py13
-rw-r--r--python/pyspark/ml/regression.py12
2 files changed, 25 insertions, 0 deletions
diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py
index 4cbe7fbd48..2e468f67b8 100644
--- a/python/pyspark/ml/classification.py
+++ b/python/pyspark/ml/classification.py
@@ -15,6 +15,9 @@
# limitations under the License.
#
+import warnings
+
+from pyspark import since
from pyspark.ml.util import keyword_only
from pyspark.ml.wrapper import JavaEstimator, JavaModel
from pyspark.ml.param.shared import *
@@ -189,9 +192,19 @@ class LogisticRegressionModel(JavaModel):
"""
Model weights.
"""
+
+ warnings.warn("weights is deprecated. Use coefficients instead.")
return self._call_java("weights")
@property
+ @since("1.6.0")
+ def coefficients(self):
+ """
+ Model coefficients.
+ """
+ return self._call_java("coefficients")
+
+ @property
def intercept(self):
"""
Model intercept.
diff --git a/python/pyspark/ml/regression.py b/python/pyspark/ml/regression.py
index dc68815556..ab26616f4a 100644
--- a/python/pyspark/ml/regression.py
+++ b/python/pyspark/ml/regression.py
@@ -15,6 +15,8 @@
# limitations under the License.
#
+import warnings
+
from pyspark import since
from pyspark.ml.util import keyword_only
from pyspark.ml.wrapper import JavaEstimator, JavaModel
@@ -117,9 +119,19 @@ class LinearRegressionModel(JavaModel):
"""
Model weights.
"""
+
+ warnings.warn("weights is deprecated. Use coefficients instead.")
return self._call_java("weights")
@property
+ @since("1.6.0")
+ def coefficients(self):
+ """
+ Model coefficients.
+ """
+ return self._call_java("coefficients")
+
+ @property
@since("1.4.0")
def intercept(self):
"""