-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21087] [ML] CrossValidator, TrainValidationSplit expose sub models after fitting: Scala #19208
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
[SPARK-21087] [ML] CrossValidator, TrainValidationSplit expose sub models after fitting: Scala #19208
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
46d3ab3
init pr
WeichenXu123 ae13440
fix style
WeichenXu123 e0f4ce6
remove code for dump models to disk
WeichenXu123 a33c4ea
merge master & resolve conflicts
WeichenXu123 e009ee1
address comment issues
WeichenXu123 931fa6c
address issues from comments
WeichenXu123 2a83fb5
fix style
WeichenXu123 f2ef609
address comments from joseph
WeichenXu123 7bacfca
address comments from joseph
WeichenXu123 654e4d5
fix mima
WeichenXu123 7e997da
address minor issues
WeichenXu123 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
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
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
Oops, something went wrong.
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.
so this var seems unnecessary, could we just it seems like we'd be better by just collecting modelFutures in copy values (then we can avoid the mutation on L145)
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.
@holdenk @jkbradley I already thought about this issue. The reason I use this way is:
modelFuturesandfoldMetricFutureswill be executed in pipelined way, when$(collectSubModels) == false, this will make sure that themodelgenerated inmodelFutureswill be released in time, so that the maximum memory cost will benumParallelism * sizeof(model). If we use the way of "collecting modelFutures", it will increase the memory cost to be$(estimatorParamMaps).length * sizeof(model). This is a serious issue which is discussed before.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.
I don't follow with #1, if we keep all the models (e.g. set
collectSubModelsParam) then the maximum memory cost will be$(estimatorParamMaps).length * sizeof(model)in either case? If we don't keep the models (e.g. setcollectSubModelsParamto false) then you don't have to collect the future back at the end and there is no additional overhead.For #2, It's not that mutation impacts performance, its that it makes the code less easy to reason about for no gain (unless I've misunderstood something about part 1).
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.
@holdenk Oh, sorry for confusing you. Yes, if set
collectSubModelsParamthe memory cost will always be$(estimatorParamMaps).length * sizeof(model). According to your suggestion, we have to duplicate code logic (but if i am wrong correct me):collectSubModelsParam, we cannot pipelinemodelFuturesandfoldMetricFutures, we should executemodelFuturesand collect results first, and modifyfoldMetricFutureslogic, change it into something like following:collectSubModelsParam, just keep currentmodelFutures&foldMetricFuturesand pipeline them to execute. (Only pipeline them we can save memory cost tonumParallelism * sizeof(model).So, according to your suggestion, it seems need more code. So do you still prefer this way ? Or do you have better way to implement that ?
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.
Sorry I didn't follow up on this before. I think that @WeichenXu123 's argument is valid, but please say if there are issues I'm missing @holdenk