Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8389280
Mark a number of alogrithms and models experimental that are marked t…
holdenk May 5, 2016
1fa57e5
Add the rest
holdenk May 5, 2016
b1ce817
Use mathjax for formula in PyDoc
holdenk May 5, 2016
8125c8c
Switch to math highlighting and update legostic regresion get doc sin…
holdenk May 5, 2016
c72fa46
Long line fix
holdenk May 5, 2016
3fd1dce
Start adding the missing params to mutli-layer perceptron, also inves…
holdenk May 5, 2016
c7caa43
Or wait we just don't need to support None
holdenk May 5, 2016
4776221
Update the doc string for weights param and add doctest that verifys …
holdenk May 6, 2016
64942b7
Merge in master
holdenk May 9, 2016
2397004
mini fix
holdenk May 10, 2016
130d05f
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk May 10, 2016
a73913b
more pydoc fix
holdenk May 10, 2016
50b41ae
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk May 10, 2016
9e38ddf
Remove flaky doctet component
holdenk May 10, 2016
f4df8f0
Add a : as requested
holdenk May 10, 2016
5df5a93
Merge in master
holdenk May 19, 2016
2eec947
Back out some unrelated changes that are in a seperate PR anyways
holdenk May 19, 2016
e11dbf8
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk May 23, 2016
4111b2d
Update scaladoc and PyDoc to both have the correct chain for getThres…
holdenk May 26, 2016
53ab790
pep8
holdenk May 26, 2016
c2c7900
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk Jun 6, 2016
a7aadec
Revert doc change
holdenk Jun 6, 2016
e4061f4
minor fix
holdenk Jun 6, 2016
7b634b6
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk Jun 7, 2016
873f6c8
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk Jun 11, 2016
9fb2e41
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk Jun 12, 2016
74636b1
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk Jun 13, 2016
d925f38
Merge branch 'master' into SPARK-15162-SPARK-15164-update-some-pydocs
holdenk Jun 14, 2016
3981612
oook lets try 86ing mathjax but... welll w/e
holdenk Jun 14, 2016
3d13c6c
reenable mathjax
holdenk Jun 14, 2016
2be8cdf
Revert "[SPARK-15745][SQL] Use classloader's getResource() for readin…
holdenk Jun 14, 2016
4431daa
Support both methods
holdenk Jun 14, 2016
d842309
Revert "Support both methods"
holdenk Jun 21, 2016
de63f9f
Revert "Revert "[SPARK-15745][SQL] Use classloader's getResource() fo…
holdenk Jun 21, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions python/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'epytext',
'sphinx.ext.mathjax',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
38 changes: 36 additions & 2 deletions python/pyspark/ml/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -154,7 +157,12 @@ def setThreshold(self, value):
@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),
this returns the equivalent threshold:
:math:`\\frac{1}{1 + \\frac{thresholds(0)}{thresholds(1)}}`.
Otherwise, returns :py:attr:`threshold` if set or its default value if unset.
"""
self._checkThresholdConsistency()
if self.isSet(self.thresholds):
Expand Down Expand Up @@ -208,6 +216,8 @@ def _checkThresholdConsistency(self):

class LogisticRegressionModel(JavaModel, JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

Model fitted by LogisticRegression.

.. versionadded:: 1.3.0
Expand Down Expand Up @@ -491,6 +501,8 @@ class DecisionTreeClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPred
TreeClassifierParams, HasCheckpointInterval, HasSeed, JavaMLWritable,
JavaMLReadable):
"""
.. note:: Experimental

`Decision tree <http://en.wikipedia.org/wiki/Decision_tree_learning>`_
learning algorithm for classification.
It supports both binary and multiclass labels, as well as both continuous and categorical
Expand Down Expand Up @@ -587,6 +599,8 @@ def _create_model(self, java_model):
@inherit_doc
class DecisionTreeClassificationModel(DecisionTreeModel, JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

Model fitted by DecisionTreeClassifier.

.. versionadded:: 1.4.0
Expand Down Expand Up @@ -620,6 +634,8 @@ class RandomForestClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPred
RandomForestParams, TreeClassifierParams, HasCheckpointInterval,
JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

`Random Forest <http://en.wikipedia.org/wiki/Random_forest>`_
learning algorithm for classification.
It supports both binary and multiclass labels, as well as both continuous and categorical
Expand Down Expand Up @@ -714,6 +730,8 @@ def _create_model(self, java_model):

class RandomForestClassificationModel(TreeEnsembleModels, JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

Model fitted by RandomForestClassifier.

.. versionadded:: 1.4.0
Expand Down Expand Up @@ -746,6 +764,8 @@ class GBTClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol
GBTParams, HasCheckpointInterval, HasStepSize, HasSeed, JavaMLWritable,
JavaMLReadable):
"""
.. note:: Experimental

`Gradient-Boosted Trees (GBTs) <http://en.wikipedia.org/wiki/Gradient_boosting>`_
learning algorithm for classification.
It supports binary labels, as well as both continuous and categorical features.
Expand Down Expand Up @@ -863,6 +883,8 @@ def getLossType(self):

class GBTClassificationModel(TreeEnsembleModels, JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

Model fitted by GBTClassifier.

.. versionadded:: 1.4.0
Expand Down Expand Up @@ -894,6 +916,8 @@ def trees(self):
class NaiveBayes(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol, HasProbabilityCol,
HasRawPredictionCol, HasThresholds, JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

Naive Bayes Classifiers.
It supports both Multinomial and Bernoulli NB. `Multinomial NB
<http://nlp.stanford.edu/IR-book/html/htmledition/naive-bayes-text-classification-1.html>`_
Expand Down Expand Up @@ -1017,6 +1041,8 @@ def getModelType(self):

class NaiveBayesModel(JavaModel, JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

Model fitted by NaiveBayes.

.. versionadded:: 1.5.0
Expand Down Expand Up @@ -1044,6 +1070,8 @@ class MultilayerPerceptronClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol,
HasMaxIter, HasTol, HasSeed, HasStepSize, JavaMLWritable,
JavaMLReadable):
"""
.. note:: Experimental

Classifier trainer based on the Multilayer Perceptron.
Each layer has sigmoid activation function, output layer has softmax.
Number of inputs has to be equal to the size of feature vectors.
Expand Down Expand Up @@ -1214,6 +1242,8 @@ def getInitialWeights(self):

class MultilayerPerceptronClassificationModel(JavaModel, JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

Model fitted by MultilayerPerceptronClassifier.

.. versionadded:: 1.6.0
Expand Down Expand Up @@ -1263,6 +1293,8 @@ def getClassifier(self):
@inherit_doc
class OneVsRest(Estimator, OneVsRestParams, MLReadable, MLWritable):
"""
.. note:: Experimental

Reduction of Multiclass Classification to Binary Classification.
Performs reduction using one against all strategy.
For a multiclass classification with k classes, train k models (one per class).
Expand Down Expand Up @@ -1417,6 +1449,8 @@ def _to_java(self):

class OneVsRestModel(Model, OneVsRestParams, MLReadable, MLWritable):
"""
.. note:: Experimental

Model fitted by OneVsRest.
This stores the models resulting from training k binary classifiers: one for each class.
Each example is scored against all k models, and the model with the highest score
Expand Down