Comments (3)
Please ignore that notebook : ). There is a pr that should make regression easier.
Anyway, to your question:
The reason why the default behavior for tabular data is discretization is that it is hard to reason about weights with non-discretized data, since you end up having to multiply the weight with the feature value to get the 'contribution'. Then you get 'double negatives' (positive contribution), and the like.
You are right that the distance is not used for weighting when discretization is on. That is a bug.
You are also right in noting that if the discretization is too broad, the explanations may not be appropriate. I would recommend trying deciles, or even trying discretize_continuous=False, but with the caveat that explanations require a little more thought for interpreting in that case.
from lime.
Thanks! That's very helpful.
I was trying to get the top 3 explanations/features for about 300K records for a model with 150 variables, and it took really long (a few days). I am wondering if it should take this long or it's because the way I am using it. I have an xgboost model and I cannot use xgboost classifier in sklearn because I have to use monotonic constraints of xgboost, so I wrote this predict_fn to make the prediction of xgboost work with LIME (I have binary tag):
sample_size=5000
n_features=150
def predict_fn(x):
df = pd.DataFrame(x.reshape((sample_size,n_features)), columns=features)
dtest = xgboost.DMatrix(df)
preds = model.predict(dtest).reshape(-1,1)
p0 = 1 - preds
return np.hstack((p0, preds))
Here is how I print the reasons:
for i in range(len(X_test)):
exp = explainer.explain_instance(X_test.iloc[i].as_matrix(), predict_fn, num_features=3, num_samples=sample_size)
print exp.as_list()
Should it take this long? or it's the workaround I am using? or as_list()?
from lime.
It sounds about right.
You are having the model predict 5K * 300K times, which totals 1.5 billion predictions. If it's taking you ~3.5 days, your model is making around 5000 predictions per second, which is about what I would expect depending on your machine.
If you want to make it faster, make the sample_size smaller.
from lime.
Related Issues (20)
- Is this Repo Maintained? HOT 2
- Can LIME only be used for text classification tasks?
- How to explain prediction for a data with just a few features (from all features of training dataset)? HOT 2
- Trying to explaine a simple Neural Network using LIME HOT 1
- submodular pick
- ans = self.domain_mapper.map_exp_ids(self.local_exp[label_to_use], **kwargs) KeyError: 1
- Getting error when my predict_fn is actually a method from a class HOT 1
- `show_in_notebook` shows no bars
- importance score for all tokens
- Unexpected keyword argument 'progress_bar' for lime_image.LimeImageExplainer().explain_instance()
- Issues with LIME Implementation in Image Classification
- How to use lime with 3 dim time series data and lstm
- Distances derivation, explain_instance() method in Tabular LIME
- How to handle binary features
- RecurrentTabularExplainer for regression task
- Question: using LIME for text generation HOT 1
- LIME and multi-correlated variables
- update Python support
- Inverse scaling/ normalization to get actual unscaled values in explanation : Old issue but I made a way around
- Met the issue about TypeError when using lime_image.LimeImageExplainer()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lime.