diff options
author | Joseph K. Bradley <joseph@databricks.com> | 2017-02-02 11:58:46 -0800 |
---|---|---|
committer | Joseph K. Bradley <joseph@databricks.com> | 2017-02-02 11:58:46 -0800 |
commit | 1d5d2a9d0940d05444b76005f3548f96ecfbde95 (patch) | |
tree | 9edc32503554b5e6592d878664d82f76b57c5431 | |
parent | 8303e20c45153f91e585e230caa29b728a4d8c6c (diff) | |
download | spark-1d5d2a9d0940d05444b76005f3548f96ecfbde95.tar.gz spark-1d5d2a9d0940d05444b76005f3548f96ecfbde95.tar.bz2 spark-1d5d2a9d0940d05444b76005f3548f96ecfbde95.zip |
[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.
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/ml/classification/LinearSVC.scala | 3 | ||||
-rw-r--r-- | python/pyspark/ml/classification.py | 9 | ||||
-rw-r--r-- | python/pyspark/ml/param/__init__.py | 13 |
3 files changed, 7 insertions, 18 deletions
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 3b14c4b004..bf6e76d7ac 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. * diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index d41fc81fd7..69f0cea82e 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 diff --git a/python/pyspark/ml/param/__init__.py b/python/pyspark/ml/param/__init__.py index ade4864e1d..dc3d23ff16 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 |