Skip to content

Commit 57cf430

Browse files
committed
address review comments
1 parent 71f7de2 commit 57cf430

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

R/pkg/R/mllib.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,10 @@ setMethod("predict", signature(object = "KMeansModel"),
748748
#' sparkR.session()
749749
#' # binary logistic regression
750750
#' label <- c(0.0, 0.0, 0.0, 1.0, 1.0)
751-
#' feature <- c(1.1419053, 0.9194079, -0.9498666, -1.1069903, 0.2809776)
752-
#' binary_data <- as.data.frame(cbind(label, feature))
751+
#' features <- c(1.1419053, 0.9194079, -0.9498666, -1.1069903, 0.2809776)
752+
#' binary_data <- as.data.frame(cbind(label, features))
753753
#' binary_df <- createDataFrame(binary_data)
754-
#' blr_model <- spark.logit(binary_df, label ~ feature, thresholds = 1.0)
754+
#' blr_model <- spark.logit(binary_df, label ~ features, thresholds = 1.0)
755755
#' blr_predict <- collect(select(predict(blr_model, binary_df), "prediction"))
756756
#'
757757
#' # summary of binary logistic regression
@@ -769,11 +769,11 @@ setMethod("predict", signature(object = "KMeansModel"),
769769
#' # multinomial logistic regression
770770
#'
771771
#' label <- c(0.0, 1.0, 2.0, 0.0, 0.0)
772-
#' feature1 <- c(4.845940, 5.64480, 7.430381, 6.464263, 5.555667)
773-
#' feature2 <- c(2.941319, 2.614812, 2.162451, 3.339474, 2.970987)
774-
#' feature3 <- c(1.322733, 1.348044, 3.861237, 9.686976, 3.447130)
775-
#' feature4 <- c(1.3246388, 0.5510444, 0.9225810, 1.2147881, 1.6020842)
776-
#' data <- as.data.frame(cbind(label, feature1, feature2, feature3, feature4))
772+
#' features1 <- c(4.845940, 5.64480, 7.430381, 6.464263, 5.555667)
773+
#' features2 <- c(2.941319, 2.614812, 2.162451, 3.339474, 2.970987)
774+
#' features3 <- c(1.322733, 1.348044, 3.861237, 9.686976, 3.447130)
775+
#' features4 <- c(1.3246388, 0.5510444, 0.9225810, 1.2147881, 1.6020842)
776+
#' data <- as.data.frame(cbind(label, features1, features2, features3, features4))
777777
#' df <- createDataFrame(data)
778778
#'
779779
#' # Note that summary of multinomial logistic regression is not implemented yet

R/pkg/inst/tests/testthat/test_mllib.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,15 +662,15 @@ test_that("spark.logit", {
662662
blr_summary <- summary(blr_model)
663663
blr_fmeasure <- collect(select(blr_summary$fMeasureByThreshold, "threshold", "F-Measure"))
664664
expect_equal(blr_fmeasure$threshold, c(0.6565513, 0.6214563, 0.3325291, 0.2115995, 0.1778653),
665-
tolerance = 1e-4)
665+
tolerance = 1e-4)
666666
expect_equal(blr_fmeasure$"F-Measure", c(0.6666667, 0.5000000, 0.8000000, 0.6666667, 0.5714286),
667-
tolerance = 1e-4)
667+
tolerance = 1e-4)
668668
blr_precision <- collect(select(blr_summary$precisionByThreshold, "threshold", "precision"))
669669
expect_equal(blr_precision$precision, c(1.0000000, 0.5000000, 0.6666667, 0.5000000, 0.4000000),
670-
tolerance = 1e-4)
670+
tolerance = 1e-4)
671671
blr_recall <- collect(select(blr_summary$recallByThreshold, "threshold", "recall"))
672672
expect_equal(blr_recall$recall, c(0.5000000, 0.5000000, 1.0000000, 1.0000000, 1.0000000),
673-
tolerance = 1e-4)
673+
tolerance = 1e-4)
674674

675675
# test model save and read
676676
modelPath <- tempfile(pattern = "spark-logisticRegression", fileext = ".tmp")

0 commit comments

Comments
 (0)