-
Notifications
You must be signed in to change notification settings - Fork 7
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
[PNE-6511] Expose feature effects generation. #983
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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "3.12.0" | ||
__version__ = "3.13.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,6 +196,14 @@ def rename(self, | |
entity = self.session.put_resource(path, json, version=self._api_version) | ||
return self.build(entity) | ||
|
||
def generate_feature_effects(self, | ||
uid: Union[UUID, str], | ||
*, | ||
version: Union[int, str] = MOST_RECENT_VER) -> GraphPredictor: | ||
path = self._construct_path(uid, version, "shapley/generate") | ||
self.session.put_resource(path, {}, version=self._api_version) | ||
return self.get(uid, version=version) | ||
Comment on lines
+204
to
+205
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 |
||
|
||
def delete(self, uid: Union[UUID, str], *, version: Union[int, str] = MOST_RECENT_VER): | ||
"""Predictor versions cannot be deleted at this time.""" | ||
msg = "Predictor versions cannot be deleted. Use 'archive_version' instead." | ||
|
@@ -578,6 +586,26 @@ def rename(self, | |
uid, version=version, name=name, description=description | ||
) | ||
|
||
def generate_feature_effects_async(self, | ||
uid: Union[UUID, str], | ||
*, | ||
version: Union[int, str]) -> GraphPredictor: | ||
"""Begin generation of feature effects. | ||
|
||
version can be any numerical version (which exists), "latest", or "most_recent". Although | ||
note that this will fail if the predictor is not already trained. | ||
|
||
Feature effects are automatically generated for all new predictors after a successful | ||
training as of the end of 2024. This call allows either regenerating those values, or | ||
generating them for older predictors. | ||
|
||
This call just begins the process; generation usually takes a few minutes, but can take | ||
much longer. As soon as the call completes, the old values will be inaccessible. To wait | ||
for the generation to complete, and to retrieve the new values once they're ready, use | ||
GraphPredictor.feature_effects. | ||
""" | ||
return self._versions_collection.generate_feature_effects(uid, version=version) | ||
|
||
def delete(self, uid: Union[UUID, str]): | ||
"""Predictors cannot be deleted at this time.""" | ||
msg = "Predictors cannot be deleted. Use 'archive_version' or 'archive_root' instead." | ||
|
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.
There was a bug in the existing code which caused it to blow up if there was no
result
field, which would happen if either Shapley hadn't been run, or if the generation was in progress.