spark git commit: [SPARK-15162][SPARK-15164][PYSPARK][DOCS][ML] update some pydocs

2016-06-22 Thread mlnick
Repository: spark
Updated Branches:
  refs/heads/branch-2.0 e7a489c7f -> 838143a2a


[SPARK-15162][SPARK-15164][PYSPARK][DOCS][ML] update some pydocs

## What changes were proposed in this pull request?

Mark ml.classification algorithms as experimental to match Scala algorithms, 
update PyDoc for for thresholds on `LogisticRegression` to have same level of 
info as Scala, and enable mathjax for PyDoc.

## How was this patch tested?

Built docs locally & PySpark SQL tests

Author: Holden Karau 

Closes #12938 from holdenk/SPARK-15162-SPARK-15164-update-some-pydocs.

(cherry picked from commit d281b0bafe6aa23085d4d2b68f0ce321f1978b50)
Signed-off-by: Nick Pentreath 


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

Branch: refs/heads/branch-2.0
Commit: 838143a2a02192a9ebc955b8060a6520b62d9644
Parents: e7a489c
Author: Holden Karau 
Authored: Wed Jun 22 11:54:49 2016 +0200
Committer: Nick Pentreath 
Committed: Wed Jun 22 11:55:10 2016 +0200

--
 .../ml/classification/LogisticRegression.scala  |  5 ++-
 python/docs/conf.py |  1 +
 python/pyspark/ml/classification.py | 38 ++--
 3 files changed, 39 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/838143a2/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
--
diff --git 
a/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
 
b/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
index a7ba39e..2fa8fbc 100644
--- 
a/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
+++ 
b/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
@@ -72,10 +72,9 @@ private[classification] trait LogisticRegressionParams 
extends ProbabilisticClas
   /**
* Get threshold for binary classification.
*
-   * If [[threshold]] is set, returns that value.
-   * Otherwise, if [[thresholds]] is set with length 2 (i.e., binary 
classification),
+   * If [[thresholds]] is set with length 2 (i.e., binary classification),
* this returns the equivalent threshold: {{{1 / (1 + thresholds(0) / 
thresholds(1))}}}.
-   * Otherwise, returns [[threshold]] default value.
+   * Otherwise, returns [[threshold]] if set, or its default value if unset.
*
* @group getParam
* @throws IllegalArgumentException if [[thresholds]] is set to an array of 
length other than 2.

http://git-wip-us.apache.org/repos/asf/spark/blob/838143a2/python/docs/conf.py
--
diff --git a/python/docs/conf.py b/python/docs/conf.py
index d35bf73..50fb317 100644
--- a/python/docs/conf.py
+++ b/python/docs/conf.py
@@ -32,6 +32,7 @@ extensions = [
 'sphinx.ext.autodoc',
 'sphinx.ext.viewcode',
 'epytext',
+'sphinx.ext.mathjax',
 ]
 
 # Add any paths that contain templates here, relative to this directory.

http://git-wip-us.apache.org/repos/asf/spark/blob/838143a2/python/pyspark/ml/classification.py
--
diff --git a/python/pyspark/ml/classification.py 
b/python/pyspark/ml/classification.py
index e86c27e..d6d713c 100644
--- a/python/pyspark/ml/classification.py
+++ b/python/pyspark/ml/classification.py
@@ -49,6 +49,8 @@ class LogisticRegression(JavaEstimator, HasFeaturesCol, 
HasLabelCol, HasPredicti
  HasElasticNetParam, HasFitIntercept, 
HasStandardization, HasThresholds,
  HasWeightCol, JavaMLWritable, JavaMLReadable):
 """
+.. note:: Experimental
+
 Logistic regression.
 Currently, this class only supports binary classification.
 
@@ -96,7 +98,8 @@ class LogisticRegression(JavaEstimator, HasFeaturesCol, 
HasLabelCol, HasPredicti
 
 threshold = Param(Params._dummy(), "threshold",
   "Threshold in binary classification prediction, in range 
[0, 1]." +
-  " If threshold and thresholds are both set, they must 
match.",
+  " If threshold and thresholds are both set, they must 
match." +
+  "e.g. if threshold is p, then thresholds must be equal 
to [1-p, p].",
   typeConverter=TypeConverters.toFloat)
 
 @keyword_only
@@ -154,7 +157,12 @@ class LogisticRegression(JavaEstimator, HasFeaturesCol, 
HasLabelCol, HasPredicti
 @since("1.4.0")
 def getThreshold(self):
 """
-Gets the value of threshold or its default value.
+Get threshold for binar

spark git commit: [SPARK-15162][SPARK-15164][PYSPARK][DOCS][ML] update some pydocs

2016-06-22 Thread mlnick
Repository: spark
Updated Branches:
  refs/heads/master 0e3ce7533 -> d281b0baf


[SPARK-15162][SPARK-15164][PYSPARK][DOCS][ML] update some pydocs

## What changes were proposed in this pull request?

Mark ml.classification algorithms as experimental to match Scala algorithms, 
update PyDoc for for thresholds on `LogisticRegression` to have same level of 
info as Scala, and enable mathjax for PyDoc.

## How was this patch tested?

Built docs locally & PySpark SQL tests

Author: Holden Karau 

Closes #12938 from holdenk/SPARK-15162-SPARK-15164-update-some-pydocs.


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

Branch: refs/heads/master
Commit: d281b0bafe6aa23085d4d2b68f0ce321f1978b50
Parents: 0e3ce75
Author: Holden Karau 
Authored: Wed Jun 22 11:54:49 2016 +0200
Committer: Nick Pentreath 
Committed: Wed Jun 22 11:54:49 2016 +0200

--
 .../ml/classification/LogisticRegression.scala  |  5 ++-
 python/docs/conf.py |  1 +
 python/pyspark/ml/classification.py | 38 ++--
 3 files changed, 39 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/d281b0ba/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
--
diff --git 
a/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
 
b/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
index a7ba39e..2fa8fbc 100644
--- 
a/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
+++ 
b/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
@@ -72,10 +72,9 @@ private[classification] trait LogisticRegressionParams 
extends ProbabilisticClas
   /**
* Get threshold for binary classification.
*
-   * If [[threshold]] is set, returns that value.
-   * Otherwise, if [[thresholds]] is set with length 2 (i.e., binary 
classification),
+   * If [[thresholds]] is set with length 2 (i.e., binary classification),
* this returns the equivalent threshold: {{{1 / (1 + thresholds(0) / 
thresholds(1))}}}.
-   * Otherwise, returns [[threshold]] default value.
+   * Otherwise, returns [[threshold]] if set, or its default value if unset.
*
* @group getParam
* @throws IllegalArgumentException if [[thresholds]] is set to an array of 
length other than 2.

http://git-wip-us.apache.org/repos/asf/spark/blob/d281b0ba/python/docs/conf.py
--
diff --git a/python/docs/conf.py b/python/docs/conf.py
index d35bf73..50fb317 100644
--- a/python/docs/conf.py
+++ b/python/docs/conf.py
@@ -32,6 +32,7 @@ extensions = [
 'sphinx.ext.autodoc',
 'sphinx.ext.viewcode',
 'epytext',
+'sphinx.ext.mathjax',
 ]
 
 # Add any paths that contain templates here, relative to this directory.

http://git-wip-us.apache.org/repos/asf/spark/blob/d281b0ba/python/pyspark/ml/classification.py
--
diff --git a/python/pyspark/ml/classification.py 
b/python/pyspark/ml/classification.py
index e86c27e..d6d713c 100644
--- a/python/pyspark/ml/classification.py
+++ b/python/pyspark/ml/classification.py
@@ -49,6 +49,8 @@ class LogisticRegression(JavaEstimator, HasFeaturesCol, 
HasLabelCol, HasPredicti
  HasElasticNetParam, HasFitIntercept, 
HasStandardization, HasThresholds,
  HasWeightCol, JavaMLWritable, JavaMLReadable):
 """
+.. note:: Experimental
+
 Logistic regression.
 Currently, this class only supports binary classification.
 
@@ -96,7 +98,8 @@ class LogisticRegression(JavaEstimator, HasFeaturesCol, 
HasLabelCol, HasPredicti
 
 threshold = Param(Params._dummy(), "threshold",
   "Threshold in binary classification prediction, in range 
[0, 1]." +
-  " If threshold and thresholds are both set, they must 
match.",
+  " If threshold and thresholds are both set, they must 
match." +
+  "e.g. if threshold is p, then thresholds must be equal 
to [1-p, p].",
   typeConverter=TypeConverters.toFloat)
 
 @keyword_only
@@ -154,7 +157,12 @@ class LogisticRegression(JavaEstimator, HasFeaturesCol, 
HasLabelCol, HasPredicti
 @since("1.4.0")
 def getThreshold(self):
 """
-Gets the value of threshold or its default value.
+Get threshold for binary classification.
+
+If :py:attr:`thresholds` is set with length 2 (i.e., binary 
classification),
+