Comments (6)
released the bug fix, so if you pip install -U explainerdashboard
then it should also work now without the patch.
from explainerdashboard.
Do you have the code that generated this error?
Just added the plot vs feature component in the latest release so could be that there are still bugs...
from explainerdashboard.
explainer = RegressionExplainer(model, X, y)
ExplainerDashboard(explainer,
importances=True,
model_summary=True,
contributions=True,
whatif=True,
shap_dependence=True,
shap_interaction=False,
decision_trees=False
).run()
where X is an dataframe of shape (1000, 37) and y a series with according target values.
from explainerdashboard.
Hmm, without seeing the data on which it breaks it is a little bit hard to debug, so could you try a few things?
-
Does it work with the built-in titanic datasets from the examples? If not it's something about your system, if it does then there's probably something different about your dataset.
-
Could you check that the indexes for the X and y match? (they should automatically be made to match, but good to check)
assert np.all(explainer.X.index == explainer.y.index)
-
Do you get the same bug when you run
explainer.plot_residuals_vs_feature("Age")
?
-
In case it still fails, could you try monkeypatching this fix and see if it helps?
import types
from explainerdashboard.explainer_plots import plotly_residuals_vs_col
def plot_residuals_vs_feature2(self, col, residuals='difference', round=2,
dropna=True, points=True, winsor=0):
"""Plot residuals vs individual features
Args:
col(str): Plot against feature col
residuals (str, {'difference', 'ratio', 'log-ratio'} optional):
How to calcualte residuals. Defaults to 'difference'.
round(int, optional): rounding to perform on residuals, defaults to 2
dropna(bool, optional): drop missing values from plot, defaults to True.
points (bool, optional): display point cloud next to violin plot.
Defaults to True.
winsor (int, 0-50, optional): percentage of outliers to winsor out of
the y-axis. Defaults to 0.
Returns:
plotly fig
"""
if self.y_missing:
raise ValueError("No y was passed to explainer, so cannot plot residuals!")
assert col in self.columns or col in self.columns_cats, \
f'{col} not in columns or columns_cats!'
col_vals = self.X_cats[col] if self.check_cats(col) else self.X[col]
na_mask = col_vals != self.na_fill if dropna else pd.Series(np.array([True]*len(col_vals)), index=self.X.index)
return plotly_residuals_vs_col(
self.y[na_mask], self.preds[na_mask], col_vals[na_mask],
residuals=residuals, idxs=self.idxs.values[na_mask], points=points,
round=round, winsor=winsor, index_name=self.index_name)
explainer.plot_residuals_vs_feature2 = types.MethodType(plot_residuals_vs_feature2, explainer)
explainer.plot_residuals_vs_feature2("Age")
from explainerdashboard.
Wait! Found it! The bug is with dataframes that have a RangeIndex. (the test datasets all have str indexes, so bug didn't show up in the tests).
For now here's the patch:
X.index = X.index.astype(str)
explainer = RegressionExplainer(model, X, y)
ExplainerDashboard(explainer,
importances=True,
model_summary=True,
contributions=True,
whatif=True,
shap_dependence=True,
shap_interaction=False,
decision_trees=False
).run()
Will release a new version soon that fixes this bug.
Thanks for finding it and pointing it out!
from explainerdashboard.
Nice catch, works perfectly now!
from explainerdashboard.
Related Issues (20)
- Add support for string labels
- support for pandas 2.0 HOT 2
- whatif component customization limiting range and rounding off decimal value
- Add support for CalibratedClassifierCV algorithm
- Support for GPUTree HOT 5
- ImportError: cannot import name 'dtreeviz' from 'dtreeviz.trees' HOT 2
- ValueError: Must pass 2-d input. HOT 1
- Showcase in a HuggingFace space? HOT 1
- Dashboard is not running correctly when I am trying to use saved joblib file. HOT 3
- Dashboards not loading from saved yaml, joblib files. HOT 2
- Speed up Dashboard joblib/yaml export HOT 3
- skorch models raising The SHAP explanations do not sum up to the model's output
- integration tests failing due dash_duo.get_logs() returning None HOT 1
- Update component plots when selecting data HOT 3
- Aggregated SHAP values for one hot encoded features are overestimated
- Logodds: difference between contributions plot and prediction box
- Unexplained running out of RAM memory with ensemble voting classifier model
- shap_values should be 2d, instead shape=(200, 21, 2)! HOT 11
- [Bug] Version `0.4.6` seems to have introduced a bug - cannot access `explainer.X_merged` when `cats` not defined HOT 3
- Error when using: db = ExplainerDashboard.from_config("dashboard.yaml").flask_server() HOT 2
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 explainerdashboard.