diff options
author | Zheng RuiFeng <ruifengz@foxmail.com> | 2016-04-28 22:44:14 -0700 |
---|---|---|
committer | Joseph K. Bradley <joseph@databricks.com> | 2016-04-28 22:44:14 -0700 |
commit | cabd54d93162a3f2a0cc7ed76fb46d8224edab94 (patch) | |
tree | ea9fd0548780ced8b3db432a068d8c7c809a4568 /python/pyspark/mllib/regression.py | |
parent | 769a909d1357766a441ff69e6e98c22c51b12c93 (diff) | |
download | spark-cabd54d93162a3f2a0cc7ed76fb46d8224edab94.tar.gz spark-cabd54d93162a3f2a0cc7ed76fb46d8224edab94.tar.bz2 spark-cabd54d93162a3f2a0cc7ed76fb46d8224edab94.zip |
[SPARK-14829][MLLIB] Deprecate GLM APIs using SGD
## What changes were proposed in this pull request?
According to the [SPARK-14829](https://issues.apache.org/jira/browse/SPARK-14829), deprecate API of LogisticRegression and LinearRegression using SGD
## How was this patch tested?
manual tests
Author: Zheng RuiFeng <ruifengz@foxmail.com>
Closes #12596 from zhengruifeng/deprecate_sgd.
Diffstat (limited to 'python/pyspark/mllib/regression.py')
-rw-r--r-- | python/pyspark/mllib/regression.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/python/pyspark/mllib/regression.py b/python/pyspark/mllib/regression.py index 3b77a62000..639c5eabaa 100644 --- a/python/pyspark/mllib/regression.py +++ b/python/pyspark/mllib/regression.py @@ -17,6 +17,7 @@ import numpy as np from numpy import array +import warnings from pyspark import RDD, since from pyspark.streaming.dstream import DStream @@ -221,6 +222,7 @@ def _regression_train_wrapper(train_func, modelClass, data, initial_weights): class LinearRegressionWithSGD(object): """ .. versionadded:: 0.9.0 + .. note:: Deprecated in 2.0.0. Use ml.regression.LinearRegression. """ @classmethod @since("0.9.0") @@ -276,6 +278,8 @@ class LinearRegressionWithSGD(object): A condition which decides iteration termination. (default: 0.001) """ + warnings.warn("Deprecated in 2.0.0. Use ml.regression.LinearRegression.") + def train(rdd, i): return callMLlibFunc("trainLinearRegressionModelWithSGD", rdd, int(iterations), float(step), float(miniBatchFraction), i, float(regParam), @@ -366,6 +370,8 @@ class LassoModel(LinearRegressionModelBase): class LassoWithSGD(object): """ .. versionadded:: 0.9.0 + .. note:: Deprecated in 2.0.0. Use ml.regression.LinearRegression with elasticNetParam = 1.0. + Note the default regParam is 0.01 for LassoWithSGD, but is 0.0 for LinearRegression. """ @classmethod @since("0.9.0") @@ -413,6 +419,10 @@ class LassoWithSGD(object): A condition which decides iteration termination. (default: 0.001) """ + warnings.warn( + "Deprecated in 2.0.0. Use ml.regression.LinearRegression with elasticNetParam = 1.0. " + "Note the default regParam is 0.01 for LassoWithSGD, but is 0.0 for LinearRegression.") + def train(rdd, i): return callMLlibFunc("trainLassoModelWithSGD", rdd, int(iterations), float(step), float(regParam), float(miniBatchFraction), i, bool(intercept), @@ -503,6 +513,9 @@ class RidgeRegressionModel(LinearRegressionModelBase): class RidgeRegressionWithSGD(object): """ .. versionadded:: 0.9.0 + .. note:: Deprecated in 2.0.0. Use ml.regression.LinearRegression with elasticNetParam = 0.0. + Note the default regParam is 0.01 for RidgeRegressionWithSGD, but is 0.0 for + LinearRegression. """ @classmethod @since("0.9.0") @@ -550,6 +563,11 @@ class RidgeRegressionWithSGD(object): A condition which decides iteration termination. (default: 0.001) """ + warnings.warn( + "Deprecated in 2.0.0. Use ml.regression.LinearRegression with elasticNetParam = 0.0. " + "Note the default regParam is 0.01 for RidgeRegressionWithSGD, but is 0.0 for " + "LinearRegression.") + def train(rdd, i): return callMLlibFunc("trainRidgeModelWithSGD", rdd, int(iterations), float(step), float(regParam), float(miniBatchFraction), i, bool(intercept), |