-
Notifications
You must be signed in to change notification settings - Fork 256
Modularized computation of protoypes importance scores #826
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
Modularized computation of protoypes importance scores #826
Conversation
…lization function.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #826 +/- ##
==========================================
- Coverage 84.65% 84.61% -0.05%
==========================================
Files 74 74
Lines 8722 8727 +5
==========================================
Hits 7384 7384
- Misses 1338 1343 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
alibi/prototypes/protoselect.py
Outdated
- ``'prototypes_indices'`` - an array of the prototypes indices. | ||
|
||
- ``'prototypes_importance'`` - an array of prototypes importance. |
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 think more grammatically correct would be to call these prototype_indices
and prototype_importances
?
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.
Similar for the name of the function.
alibi/prototypes/protoselect.py
Outdated
|
||
- ``'X_protos'`` - an array of raw prototypes. | ||
|
||
- ``'X_protos_ft'`` - an array of preprocessed prototypes. If the ``preprocess_fn=None``, no preprocessing \ |
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.
Should this be None
(or empty) if there is no pre-processing? Basically do we avoid duplicating the same data?
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.
Good point!
alibi/prototypes/protoselect.py
Outdated
def compute_prototype_importances(summary: 'Explanation', | ||
trainset: Tuple[np.ndarray, np.ndarray], | ||
preprocess_fn: Optional[Callable[[np.ndarray], np.ndarray]] = None, | ||
knn_kw: Optional[dict] = None): |
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.
Just noticed - missing return type.
* Modularized computation of protoypes importance scores from the visualization function. * Updated .gitignore. Changed notebook kernel. * Reverted .pymon and .gitignore. * Duplicate docstrings and reverted example. * Replaced prototypes_* to prototype_*. * Avoid duplication when plotting the prototypes * Updated example notebook. * Included missing return type.
* Modularized computation of protoypes importance scores from the visualization function. * Updated .gitignore. Changed notebook kernel. * Reverted .pymon and .gitignore. * Duplicate docstrings and reverted example. * Replaced prototypes_* to prototype_*. * Avoid duplication when plotting the prototypes * Updated example notebook. * Included missing return type.
This PR modularises the computation of prototypes importance scores from the visualisation function. This gives the option to compute the importance and use a different tool to plot the 2D representation of the prototypes.