-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-18724][ML] Add TuningSummary for TrainValidationSplit and CrossValidator #16158
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d1e22d5
tuning summary
YY-OnCall a7cfa63
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall ad73c12
add ut
YY-OnCall 425a419
add comments
YY-OnCall bd18c00
get default spark session
YY-OnCall 2a0af1d
resolve merge conflict
YY-OnCall 1a594d0
merge conflict
YY-OnCall 0a698fe
support cross validation
YY-OnCall bd459b1
update version
YY-OnCall 4e3e19c
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall c0bc81a
improve unit test
YY-OnCall bbf3f9f
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall b6a7c53
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall 72aea62
remove TuningSummary
YY-OnCall 91da358
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall 297091f
update for pipeline
YY-OnCall 670467a
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall 36b1dd5
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall 5844e0c
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall 8c829b5
merge conflict
YY-OnCall 4aaf8e5
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall ceaad1c
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall 41c4c12
Merge remote-tracking branch 'upstream/master' into tuningsummary
YY-OnCall 4aef3aa
remove sort add comments
YY-OnCall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
improve unit test
- Loading branch information
commit c0bc81a976bb00d1ad5b31164f61df7fa971cc91
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ import org.apache.spark.ml.param.shared.HasInputCol | |
| import org.apache.spark.ml.regression.LinearRegression | ||
| import org.apache.spark.ml.util.{DefaultReadWriteTest, MLTestingUtils} | ||
| import org.apache.spark.mllib.util.{LinearDataGenerator, MLlibTestSparkContext} | ||
| import org.apache.spark.sql.Dataset | ||
| import org.apache.spark.sql.{Dataset, Row} | ||
| import org.apache.spark.sql.types.StructType | ||
|
|
||
| class CrossValidatorSuite | ||
|
|
@@ -82,16 +82,11 @@ class CrossValidatorSuite | |
| assert(cvModel.hasSummary) | ||
| assert(cvModel.summary.params === lrParamMaps) | ||
| assert(cvModel.summary.trainingMetrics.count() === lrParamMaps.length) | ||
| val expectedSummary = spark.createDataFrame(Seq( | ||
| (0, 0.001), | ||
| (2, 0.001), | ||
| (0, 1.0), | ||
| (2, 1.0), | ||
| (0, 1000.0), | ||
| (2, 1000.0) | ||
| ).map(t => (t._1.toString, t._2.toString))).toDF("maxIter", "regParam") | ||
| assert(cvModel.summary.trainingMetrics.select("maxIter", "regParam").collect().toSet | ||
| .equals(expectedSummary.collect().toSet)) | ||
|
|
||
| val expected = lrParamMaps.zip(cvModel.avgMetrics).map { case (map, metric) => | ||
| Row.fromSeq(map.toSeq.sortBy(_.param.name).map(_.value.toString) ++ Seq(metric.toString)) | ||
| } | ||
| assert(cvModel.summary.trainingMetrics.collect().toSet === expected.toSet) | ||
| } | ||
|
|
||
|
Contributor
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. Shall we add a test for the exception being thrown if no summary? |
||
| test("cross validation with linear regression") { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
It appears
bestIndexis never used?