From 1821cbead1875fbe1c16d7c50563aa0839e1f70f Mon Sep 17 00:00:00 2001 From: Yanbo Liang <ybliang8@gmail.com> Date: Mon, 5 Dec 2016 00:39:44 -0800 Subject: [PATCH] [SPARK-18279][DOC][ML][SPARKR] Add R examples to ML programming guide. ## What changes were proposed in this pull request? Add R examples to ML programming guide for the following algorithms as POC: * spark.glm * spark.survreg * spark.naiveBayes * spark.kmeans The four algorithms were added to SparkR since 2.0.0, more docs for algorithms added during 2.1 release cycle will be addressed in a separate follow-up PR. ## How was this patch tested? This is the screenshots of generated ML programming guide for ```GeneralizedLinearRegression```:  Author: Yanbo Liang <ybliang8@gmail.com> Closes #16136 from yanboliang/spark-18279. (cherry picked from commit eb8dd68132998aa00902dfeb935db1358781e1c1) Signed-off-by: Yanbo Liang <ybliang8@gmail.com> --- docs/ml-classification-regression.md | 22 ++++++++++++++++++++++ docs/ml-clustering.md | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/docs/ml-classification-regression.md b/docs/ml-classification-regression.md index c72c01fcff..5148ad02d9 100644 --- a/docs/ml-classification-regression.md +++ b/docs/ml-classification-regression.md @@ -389,6 +389,14 @@ Refer to the [Python API docs](api/python/pyspark.ml.html#pyspark.ml.classificat {% include_example python/ml/naive_bayes_example.py %} </div> + +<div data-lang="r" markdown="1"> + +Refer to the [R API docs](api/R/spark.naiveBayes.html) for more details. + +{% include_example naiveBayes r/ml.R %} +</div> + </div> @@ -566,6 +574,13 @@ Refer to the [Python API docs](api/python/pyspark.ml.html#pyspark.ml.regression. {% include_example python/ml/generalized_linear_regression_example.py %} </div> +<div data-lang="r" markdown="1"> + +Refer to the [R API docs](api/R/spark.glm.html) for more details. + +{% include_example glm r/ml.R %} +</div> + </div> @@ -755,6 +770,13 @@ Refer to the [Python API docs](api/python/pyspark.ml.html#pyspark.ml.regression. {% include_example python/ml/aft_survival_regression.py %} </div> +<div data-lang="r" markdown="1"> + +Refer to the [R API docs](api/R/spark.survreg.html) for more details. + +{% include_example survreg r/ml.R %} +</div> + </div> diff --git a/docs/ml-clustering.md b/docs/ml-clustering.md index 8a0a61cb59..4731abc7dc 100644 --- a/docs/ml-clustering.md +++ b/docs/ml-clustering.md @@ -86,6 +86,14 @@ Refer to the [Python API docs](api/python/pyspark.ml.html#pyspark.ml.clustering. {% include_example python/ml/kmeans_example.py %} </div> + +<div data-lang="r" markdown="1"> + +Refer to the [R API docs](api/R/spark.kmeans.html) for more details. + +{% include_example kmeans r/ml.R %} +</div> + </div> ## Latent Dirichlet allocation (LDA) -- GitLab