spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From felixche...@apache.org
Subject spark git commit: [SPARKR][EXAMPLES] update examples to stop spark session
Date Fri, 17 Feb 2017 21:30:59 GMT
Repository: spark
Updated Branches:
  refs/heads/master b40659838 -> 988f6d7ee


[SPARKR][EXAMPLES] update examples to stop spark session

## What changes were proposed in this pull request?

stop session at end of example

## How was this patch tested?

manual

Author: Felix Cheung <felixcheung_m@hotmail.com>

Closes #16973 from felixcheung/rexamples.


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

Branch: refs/heads/master
Commit: 988f6d7ee8017756645f2af9993ee020332442cb
Parents: b406598
Author: Felix Cheung <felixcheung_m@hotmail.com>
Authored: Fri Feb 17 13:30:55 2017 -0800
Committer: Felix Cheung <felixcheung@apache.org>
Committed: Fri Feb 17 13:30:55 2017 -0800

----------------------------------------------------------------------
 examples/src/main/r/ml/als.R             | 4 +++-
 examples/src/main/r/ml/bisectingKmeans.R | 2 ++
 examples/src/main/r/ml/gaussianMixture.R | 4 +++-
 examples/src/main/r/ml/gbt.R             | 6 ++++--
 examples/src/main/r/ml/glm.R             | 6 ++++--
 examples/src/main/r/ml/isoreg.R          | 4 +++-
 examples/src/main/r/ml/kmeans.R          | 6 ++++--
 examples/src/main/r/ml/kstest.R          | 2 ++
 examples/src/main/r/ml/lda.R             | 4 +++-
 examples/src/main/r/ml/logit.R           | 6 ++++--
 examples/src/main/r/ml/ml.R              | 2 +-
 examples/src/main/r/ml/mlp.R             | 4 +++-
 examples/src/main/r/ml/naiveBayes.R      | 4 +++-
 examples/src/main/r/ml/randomForest.R    | 6 ++++--
 examples/src/main/r/ml/survreg.R         | 4 +++-
 15 files changed, 46 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/als.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/als.R b/examples/src/main/r/ml/als.R
index 383bbba..4d1c91a 100644
--- a/examples/src/main/r/ml/als.R
+++ b/examples/src/main/r/ml/als.R
@@ -41,5 +41,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/bisectingKmeans.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/bisectingKmeans.R b/examples/src/main/r/ml/bisectingKmeans.R
index 37aeb74..5fb5bfb 100644
--- a/examples/src/main/r/ml/bisectingKmeans.R
+++ b/examples/src/main/r/ml/bisectingKmeans.R
@@ -40,3 +40,5 @@ summary(fitted.model)
 fitted <- predict(model, df)
 head(select(fitted, "Sepal_Length", "prediction"))
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/gaussianMixture.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/gaussianMixture.R b/examples/src/main/r/ml/gaussianMixture.R
index 54b69ac..558e44c 100644
--- a/examples/src/main/r/ml/gaussianMixture.R
+++ b/examples/src/main/r/ml/gaussianMixture.R
@@ -38,5 +38,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/gbt.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/gbt.R b/examples/src/main/r/ml/gbt.R
index be16c2a..bc654f1 100644
--- a/examples/src/main/r/ml/gbt.R
+++ b/examples/src/main/r/ml/gbt.R
@@ -40,7 +40,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off:classification$
 
 # GBT regression model
@@ -59,5 +59,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off:regression$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/glm.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/glm.R b/examples/src/main/r/ml/glm.R
index 5990717..e41af97 100644
--- a/examples/src/main/r/ml/glm.R
+++ b/examples/src/main/r/ml/glm.R
@@ -36,7 +36,7 @@ summary(gaussianGLM)
 
 # Prediction
 gaussianPredictions <- predict(gaussianGLM, gaussianTestDF)
-showDF(gaussianPredictions)
+head(gaussianPredictions)
 
 # Fit a generalized linear model with glm (R-compliant)
 gaussianGLM2 <- glm(Sepal_Length ~ Sepal_Width + Species, gaussianDF, family = "gaussian")
@@ -53,5 +53,7 @@ summary(binomialGLM)
 
 # Prediction
 binomialPredictions <- predict(binomialGLM, binomialTestDF)
-showDF(binomialPredictions)
+head(binomialPredictions)
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/isoreg.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/isoreg.R b/examples/src/main/r/ml/isoreg.R
index 75dce97..a53c83e 100644
--- a/examples/src/main/r/ml/isoreg.R
+++ b/examples/src/main/r/ml/isoreg.R
@@ -38,5 +38,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/kmeans.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/kmeans.R b/examples/src/main/r/ml/kmeans.R
index 043b21b..288e2f9 100644
--- a/examples/src/main/r/ml/kmeans.R
+++ b/examples/src/main/r/ml/kmeans.R
@@ -36,9 +36,11 @@ kmeansModel <- spark.kmeans(kmeansDF, ~ Sepal_Length + Sepal_Width +
Petal_Lengt
 summary(kmeansModel)
 
 # Get fitted result from the k-means model
-showDF(fitted(kmeansModel))
+head(fitted(kmeansModel))
 
 # Prediction
 kmeansPredictions <- predict(kmeansModel, kmeansTestDF)
-showDF(kmeansPredictions)
+head(kmeansPredictions)
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/kstest.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/kstest.R b/examples/src/main/r/ml/kstest.R
index 12625f7..e2b0770 100644
--- a/examples/src/main/r/ml/kstest.R
+++ b/examples/src/main/r/ml/kstest.R
@@ -37,3 +37,5 @@ model <- spark.kstest(df, "test", "norm")
 # Model summary
 summary(model)
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/lda.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/lda.R b/examples/src/main/r/ml/lda.R
index 7b187d1..769be0a 100644
--- a/examples/src/main/r/ml/lda.R
+++ b/examples/src/main/r/ml/lda.R
@@ -38,9 +38,11 @@ summary(model)
 
 # Posterior probabilities
 posterior <- spark.posterior(model, test)
-showDF(posterior)
+head(posterior)
 
 # The log perplexity of the LDA model
 logPerplexity <- spark.perplexity(model, test)
 print(paste0("The upper bound bound on perplexity: ", logPerplexity))
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/logit.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/logit.R b/examples/src/main/r/ml/logit.R
index a2ac882..4c8fd42 100644
--- a/examples/src/main/r/ml/logit.R
+++ b/examples/src/main/r/ml/logit.R
@@ -40,7 +40,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off:binomial$
 
 # Multinomial logistic regression
@@ -59,5 +59,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off:multinomial$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/ml.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/ml.R b/examples/src/main/r/ml/ml.R
index 05f5199..b968194 100644
--- a/examples/src/main/r/ml/ml.R
+++ b/examples/src/main/r/ml/ml.R
@@ -42,7 +42,7 @@ summary(gaussianGLM2)
 
 # Check model prediction
 gaussianPredictions <- predict(gaussianGLM2, gaussianTestDF)
-showDF(gaussianPredictions)
+head(gaussianPredictions)
 
 unlink(modelPath)
 # $example off:read_write$

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/mlp.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/mlp.R b/examples/src/main/r/ml/mlp.R
index d28fc06..b69ac84 100644
--- a/examples/src/main/r/ml/mlp.R
+++ b/examples/src/main/r/ml/mlp.R
@@ -44,5 +44,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/naiveBayes.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/naiveBayes.R b/examples/src/main/r/ml/naiveBayes.R
index 9c41659..da69e93 100644
--- a/examples/src/main/r/ml/naiveBayes.R
+++ b/examples/src/main/r/ml/naiveBayes.R
@@ -37,5 +37,7 @@ summary(nbModel)
 
 # Prediction
 nbPredictions <- predict(nbModel, nbTestDF)
-showDF(nbPredictions)
+head(nbPredictions)
 # $example off$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/randomForest.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/randomForest.R b/examples/src/main/r/ml/randomForest.R
index d1b96b6..5d99502 100644
--- a/examples/src/main/r/ml/randomForest.R
+++ b/examples/src/main/r/ml/randomForest.R
@@ -40,7 +40,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off:classification$
 
 # Random forest regression model
@@ -59,5 +59,7 @@ summary(model)
 
 # Prediction
 predictions <- predict(model, test)
-showDF(predictions)
+head(predictions)
 # $example off:regression$
+
+sparkR.session.stop()

http://git-wip-us.apache.org/repos/asf/spark/blob/988f6d7e/examples/src/main/r/ml/survreg.R
----------------------------------------------------------------------
diff --git a/examples/src/main/r/ml/survreg.R b/examples/src/main/r/ml/survreg.R
index f728b8b..bf6c0a1 100644
--- a/examples/src/main/r/ml/survreg.R
+++ b/examples/src/main/r/ml/survreg.R
@@ -39,5 +39,7 @@ summary(aftModel)
 
 # Prediction
 aftPredictions <- predict(aftModel, aftTestDF)
-showDF(aftPredictions)
+head(aftPredictions)
 # $example off$
+
+sparkR.session.stop()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message