-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17315][Follow-up][SparkR][ML] Fix print of Kolmogorov-Smirnov test summary #15139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -760,13 +760,7 @@ test_that("spark.kstest", { | |
|
|
||
| expect_equal(stats$p.value, rStats$p.value, tolerance = 1e-4) | ||
| expect_equal(stats$statistic, unname(rStats$statistic), tolerance = 1e-4) | ||
|
|
||
| printStr <- print.summary.KSTest(testResult) | ||
| expect_match(printStr, paste0("Kolmogorov-Smirnov test summary:\\n", | ||
| "degrees of freedom = 0 \\n", | ||
| "statistic = 0.38208[0-9]* \\n", | ||
| "pValue = 0.19849[0-9]* \\n", | ||
| ".*"), perl = TRUE) | ||
| expect_match(capture.output(stats)[1], "Kolmogorov-Smirnov test summary:") | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should have test for the function and its output?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's easy to turn this into capture.output to avoid polluting output.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The output is relevant to the implementation of |
||
| testResult <- spark.kstest(df, "test", "norm", -0.5) | ||
| stats <- summary(testResult) | ||
|
|
@@ -775,13 +769,7 @@ test_that("spark.kstest", { | |
|
|
||
| expect_equal(stats$p.value, rStats$p.value, tolerance = 1e-4) | ||
| expect_equal(stats$statistic, unname(rStats$statistic), tolerance = 1e-4) | ||
|
|
||
| printStr <- print.summary.KSTest(testResult) | ||
| expect_match(printStr, paste0("Kolmogorov-Smirnov test summary:\\n", | ||
| "degrees of freedom = 0 \\n", | ||
| "statistic = 0.44003[0-9]* \\n", | ||
| "pValue = 0.09470[0-9]* \\n", | ||
| ".*"), perl = TRUE) | ||
| expect_match(capture.output(stats)[1], "Kolmogorov-Smirnov test summary:") | ||
| }) | ||
|
|
||
| sparkR.session.stop() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does jobj show up in the summary? this seems to be different to our other implementation?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it's ok to show up. This implementation is a little different from others since we would like to reuse the summary information output string which was defined at Scala side, otherwise, we should reimplement a same one at R side. We implement the summary information output string at R side directly for other wrappers such as
GLM, since we do not have appropriate toString implementation at Scala side. Maybe we may unify them later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly - I'm not sure if there is a better way to do this; but likely better if we have some consistent way to do this for later.