-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
PR to handle columns of a dataframe that are not of type float #218
Open
RanaivosonHerimanitra
wants to merge
31
commits into
marcotcr:master
Choose a base branch
from
RanaivosonHerimanitra:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
301eac9
when a row of a df is passed to an explainer tabular instance, error …
3d4f73f
handle case when a row is numpy.ndarray
RanaivosonHerimanitra 9c7a461
fix error when retrieving names in np.ndarray
RanaivosonHerimanitra 1e5b067
valueError to AttributeError for catching errors
RanaivosonHerimanitra ee29e5d
handle nonetype
RanaivosonHerimanitra 6d694b5
handle nonetype corrected
RanaivosonHerimanitra c2e5c93
fill flake8 spec
RanaivosonHerimanitra f00f1c2
flake8 fix v2
RanaivosonHerimanitra 86b105b
Delete init.py
RanaivosonHerimanitra bf6f8c5
delete table_perf.py
RanaivosonHerimanitra ba58035
delete text_perf.py
RanaivosonHerimanitra 8b4affc
delete bundle.js
RanaivosonHerimanitra 5f2f39f
delete __init__.py
RanaivosonHerimanitra 0ffa5fb
delete webpack.config.js
RanaivosonHerimanitra f9faf16
delete lime_image.py
RanaivosonHerimanitra 710dcc6
delete discretize.py
RanaivosonHerimanitra 29569b4
delete explanation.py
RanaivosonHerimanitra ae5a834
delete exceptions.py
RanaivosonHerimanitra d4e686e
delete lime_base.py
RanaivosonHerimanitra 1662e67
delete lime_tabular.py
RanaivosonHerimanitra 82411c8
delete lime_text.py
RanaivosonHerimanitra 0b2263f
delete test_discretize.py
RanaivosonHerimanitra eb80d02
delete test_generic
RanaivosonHerimanitra 7865099
delete limte_text.py
RanaivosonHerimanitra 7a5aafb
delete test_scikit_image
RanaivosonHerimanitra a9a4f9e
delete generic_utils.py
RanaivosonHerimanitra 313b5d5
delete scikit_image.py
RanaivosonHerimanitra 6819aae
delete test_lime_tabular
RanaivosonHerimanitra ebdb836
delete folder __init__
RanaivosonHerimanitra a84b631
delete folder utils init
RanaivosonHerimanitra af92188
delete folder wrappers init
RanaivosonHerimanitra 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 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 |
---|---|---|
|
@@ -316,9 +316,19 @@ def explain_instance(self, | |
feature_names = copy.deepcopy(self.feature_names) | ||
if feature_names is None: | ||
feature_names = [str(x) for x in range(data_row.shape[0])] | ||
|
||
values = self.convert_and_round(data_row) | ||
|
||
# get column names if numpy.ndarray or pandas df: | ||
try: | ||
col_names = list(data_row.columns) | ||
except AttributeError: | ||
if data_row.dtype.names is not None: | ||
col_names = list(data_row.dtype.names) | ||
else: | ||
col_names = [] | ||
if len(col_names) != 0: | ||
if np.sum([1 if str(k).isdigit() else 0 for k in col_names]) != len(col_names): | ||
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. I don't understand this line. Why is it meaningful if column names are all digits, and why does it matter if all columns have digit names? Also, what happens if this is False? values seem to be undefined then |
||
values = self.convert_and_round(data_row.values[0]) | ||
else: | ||
values = self.convert_and_round(data_row) | ||
for i in self.categorical_features: | ||
if self.discretizer is not None and i in self.discretizer.lambdas: | ||
continue | ||
|
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.
Could we possibly check if the type is a pandas df rather than doing that via try / catch? It's a little awkward to have the most common use case be in an exception.