spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkbrad...@apache.org
Subject spark git commit: [SPARK-19389][ML][PYTHON][DOC] Minor doc fixes for ML Python Params and LinearSVC
Date Thu, 02 Feb 2017 19:58:55 GMT
Repository: spark
Updated Branches:
  refs/heads/master 8303e20c4 -> 1d5d2a9d0


[SPARK-19389][ML][PYTHON][DOC] Minor doc fixes for ML Python Params and LinearSVC

## What changes were proposed in this pull request?

* Removed Since tags in Python Params since they are inherited by other classes
* Fixed doc links for LinearSVC

## How was this patch tested?

* doc tests
* generating docs locally and checking manually

Author: Joseph K. Bradley <joseph@databricks.com>

Closes #16723 from jkbradley/pyparam-fix-doc.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/1d5d2a9d
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/1d5d2a9d
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/1d5d2a9d

Branch: refs/heads/master
Commit: 1d5d2a9d0940d05444b76005f3548f96ecfbde95
Parents: 8303e20
Author: Joseph K. Bradley <joseph@databricks.com>
Authored: Thu Feb 2 11:58:46 2017 -0800
Committer: Joseph K. Bradley <joseph@databricks.com>
Committed: Thu Feb 2 11:58:46 2017 -0800

----------------------------------------------------------------------
 .../org/apache/spark/ml/classification/LinearSVC.scala |  3 ++-
 python/pyspark/ml/classification.py                    |  9 +++++----
 python/pyspark/ml/param/__init__.py                    | 13 -------------
 3 files changed, 7 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/1d5d2a9d/mllib/src/main/scala/org/apache/spark/ml/classification/LinearSVC.scala
----------------------------------------------------------------------
diff --git a/mllib/src/main/scala/org/apache/spark/ml/classification/LinearSVC.scala b/mllib/src/main/scala/org/apache/spark/ml/classification/LinearSVC.scala
index 3b14c4b..bf6e76d 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/classification/LinearSVC.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/classification/LinearSVC.scala
@@ -47,7 +47,8 @@ private[classification] trait LinearSVCParams extends ClassifierParams with
HasR
 /**
  * :: Experimental ::
  *
- * Linear SVM Classifier (https://en.wikipedia.org/wiki/Support_vector_machine#Linear_SVM)
+ * <a href = "https://en.wikipedia.org/wiki/Support_vector_machine#Linear_SVM">
+ *   Linear SVM Classifier</a>
  *
  * This binary classifier optimizes the Hinge Loss using the OWLQN optimizer.
  *

http://git-wip-us.apache.org/repos/asf/spark/blob/1d5d2a9d/python/pyspark/ml/classification.py
----------------------------------------------------------------------
diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py
index d41fc81..69f0cea 100644
--- a/python/pyspark/ml/classification.py
+++ b/python/pyspark/ml/classification.py
@@ -65,7 +65,10 @@ class LinearSVC(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol,
Ha
                 HasRegParam, HasTol, HasRawPredictionCol, HasFitIntercept, HasStandardization,
                 HasThreshold, HasWeightCol, HasAggregationDepth, JavaMLWritable, JavaMLReadable):
     """
+    .. note:: Experimental
+
     `Linear SVM Classifier <https://en.wikipedia.org/wiki/Support_vector_machine#Linear_SVM>`_
+
     This binary classifier optimizes the Hinge Loss using the OWLQN optimizer.
 
     >>> from pyspark.sql import Row
@@ -89,10 +92,6 @@ class LinearSVC(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol,
Ha
     1.0
     >>> result.rawPrediction
     DenseVector([-1.4831, 1.4831])
-    >>> svm.setParams("vector")
-    Traceback (most recent call last):
-        ...
-    TypeError: Method setParams forces keyword arguments.
     >>> svm_path = temp_path + "/svm"
     >>> svm.save(svm_path)
     >>> svm2 = LinearSVC.load(svm_path)
@@ -150,6 +149,8 @@ class LinearSVC(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol,
Ha
 
 class LinearSVCModel(JavaModel, JavaClassificationModel, JavaMLWritable, JavaMLReadable):
     """
+    .. note:: Experimental
+
     Model fitted by LinearSVC.
 
     .. versionadded:: 2.2.0

http://git-wip-us.apache.org/repos/asf/spark/blob/1d5d2a9d/python/pyspark/ml/param/__init__.py
----------------------------------------------------------------------
diff --git a/python/pyspark/ml/param/__init__.py b/python/pyspark/ml/param/__init__.py
index ade4864..dc3d23f 100644
--- a/python/pyspark/ml/param/__init__.py
+++ b/python/pyspark/ml/param/__init__.py
@@ -24,11 +24,9 @@ if sys.version > '3':
 from abc import ABCMeta
 import copy
 import numpy as np
-import warnings
 
 from py4j.java_gateway import JavaObject
 
-from pyspark import since
 from pyspark.ml.linalg import DenseVector, Vector
 from pyspark.ml.util import Identifiable
 
@@ -251,7 +249,6 @@ class Params(Identifiable):
             setattr(self, name, param._copy_new_parent(self))
 
     @property
-    @since("1.3.0")
     def params(self):
         """
         Returns all params ordered by name. The default implementation
@@ -264,7 +261,6 @@ class Params(Identifiable):
                                         not isinstance(getattr(type(self), x, None), property)]))
         return self._params
 
-    @since("1.4.0")
     def explainParam(self, param):
         """
         Explains a single param and returns its name, doc, and optional
@@ -282,7 +278,6 @@ class Params(Identifiable):
         valueStr = "(" + ", ".join(values) + ")"
         return "%s: %s %s" % (param.name, param.doc, valueStr)
 
-    @since("1.4.0")
     def explainParams(self):
         """
         Returns the documentation of all params with their optionally
@@ -290,7 +285,6 @@ class Params(Identifiable):
         """
         return "\n".join([self.explainParam(param) for param in self.params])
 
-    @since("1.4.0")
     def getParam(self, paramName):
         """
         Gets a param by its name.
@@ -301,7 +295,6 @@ class Params(Identifiable):
         else:
             raise ValueError("Cannot find param with name %s." % paramName)
 
-    @since("1.4.0")
     def isSet(self, param):
         """
         Checks whether a param is explicitly set by user.
@@ -309,7 +302,6 @@ class Params(Identifiable):
         param = self._resolveParam(param)
         return param in self._paramMap
 
-    @since("1.4.0")
     def hasDefault(self, param):
         """
         Checks whether a param has a default value.
@@ -317,7 +309,6 @@ class Params(Identifiable):
         param = self._resolveParam(param)
         return param in self._defaultParamMap
 
-    @since("1.4.0")
     def isDefined(self, param):
         """
         Checks whether a param is explicitly set by user or has
@@ -325,7 +316,6 @@ class Params(Identifiable):
         """
         return self.isSet(param) or self.hasDefault(param)
 
-    @since("1.4.0")
     def hasParam(self, paramName):
         """
         Tests whether this instance contains a param with a given
@@ -337,7 +327,6 @@ class Params(Identifiable):
         else:
             raise TypeError("hasParam(): paramName must be a string")
 
-    @since("1.4.0")
     def getOrDefault(self, param):
         """
         Gets the value of a param in the user-supplied param map or its
@@ -349,7 +338,6 @@ class Params(Identifiable):
         else:
             return self._defaultParamMap[param]
 
-    @since("1.4.0")
     def extractParamMap(self, extra=None):
         """
         Extracts the embedded default param values and user-supplied
@@ -368,7 +356,6 @@ class Params(Identifiable):
         paramMap.update(extra)
         return paramMap
 
-    @since("1.4.0")
     def copy(self, extra=None):
         """
         Creates a copy of this instance with the same uid and some


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message