-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-51551] [ML] [PYTHON] [CONNECT] For tuning algorithm, allow using save / load to replace cache #50324
Conversation
Signed-off-by: Weichen Xu <[email protected]>
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.
need tests against this change
python/pyspark/ml/tuning.py
Outdated
@@ -75,6 +76,15 @@ | |||
] | |||
|
|||
|
|||
_SPARKML_TUNING_TEMP_DFS_PATH = "SPARKML_TUNING_TEMP_DFS_PATH" |
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.
what about a new parameter instead of this env variable?
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.
Spark config is not available in some circumstances. so I suggest to use environmental variable to config.
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
python/pyspark/ml/tuning.py
Outdated
validation = datasets[i][1] | ||
train = datasets[i][0] | ||
|
||
if tmp_dfs_path: |
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.
let's define a helper function:
def _cache(df):
if ...:
df.cache()
else:
spark = df._session
df.save
spark.read...
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.
then we need to handler the uncache step together in the helper function, i.e., it should be a context manager. is this you want ?
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.
context manager is a good idea
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
merged to master. |
…save / load to replace cache ### What changes were proposed in this pull request? For tuning algorithm, allow using save / load to replace cache. ### Why are the changes needed? Dataframe persisting is not well supported in certain cases, so we need a replacement. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Manually. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#50324 from WeichenXu123/SPARK-51551. Authored-by: Weichen Xu <[email protected]> Signed-off-by: Weichen Xu <[email protected]>
What changes were proposed in this pull request?
For tuning algorithm, allow using save / load to replace cache.
Why are the changes needed?
Dataframe persisting is not well supported in certain cases, so we need a replacement.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Manually.
Was this patch authored or co-authored using generative AI tooling?
No.