Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6296#discussion_r30760842
  
    --- Diff: docs/ml-ensembles.md ---
    @@ -0,0 +1,73 @@
    +---
    +layout: global
    +title: Ensembles
    +displayTitle: <a href="ml-guide.html">ML</a> - Ensembles
    +---
    +
    +* Table of contents
    +{:toc}
    +
    +An [ensemble method](http://en.wikipedia.org/wiki/Ensemble_learning)
    +is a learning algorithm which creates a model composed of a set of other 
base models.
    +ML supports the following ensemble algorithms: 
[`OneVsRest`](api/scala/index.html#org.apache.spark.ml.classifier.OneVsRest)
    +
    +## OneVsRest
    +
    
+[OneVsRest](http://en.wikipedia.org/wiki/Multiclass_classification#One-vs.-rest)
 is an example of a machine learning reduction for performing multiclass 
classification given a base classifier that can perform binary classification 
efficiently.
    +
    +`OneVsRest` is implemented as an `Estimator` takes as base classifier 
instances of `Classifier` and creates a binary classification problem for each 
of the k classes. The classifier for class i is trained to predict whether the 
label is i or not, distinguishing class i from all other classes.
    +
    +Predictions are done by evaluating each binary classifier and the index of 
the most confident classifier is output as label.
    +
    +### Example
    +
    +The example below demonstrates how to load a
    +[LIBSVM data 
file](http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/), parse it as an 
RDD of `LabeledPoint` and perform multiclass classification using `OneVsRest`. 
The test error is calculated to measure the algorithm accuracy.
    +
    +<div class="codetabs">
    +<div data-lang="scala" markdown="1">
    +{% highlight scala %}
    +import org.apache.spark.ml.classification.{LogisticRegression, OneVsRest}
    +import org.apache.spark.ml.util.MetadataUtils
    +import org.apache.spark.mllib.evaluation.MulticlassMetrics
    +import org.apache.spark.mllib.util.MLUtils
    +import org.apache.spark.sql.{Row, SQLContext}
    +import org.apache.spark.sql.functions._
    +
    +val sqlContext = new SQLContext(sc)
    +import sqlContext.implicits._
    +
    +// parse data into dataframe
    +val data = MLUtils.loadLibSVMFile(sc, 
"data/mllib/sample_multiclass_classification_data.txt")
    +.toDF()
    +.withColumn("rnd", rand(0))
    --- End diff --
    
    Use DataFrame.randomSplit instead


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to