Note
Click here to download the full example code
01. Explainer Dash
This example runs an app which an interactive user interface to explore the importance of the features using SHAP values.
Out:
"\n# Libraries\nfrom sklearn.ensemble import RandomForestClassifier\nfrom explainerdashboard import ClassifierExplainer\nfrom explainerdashboard import ExplainerDashboard\nfrom explainerdashboard.datasets import titanic_survive\nfrom explainerdashboard.datasets import feature_descriptions\n\n# Get data\nX_train, y_train, X_test, y_test = titanic_survive()\n\n# Create and fit model\nmodel = RandomForestClassifier(n_estimators=50, max_depth=10) .fit(X_train, y_train)\n\n# Configure explainer\nexplainer = ClassifierExplainer(model, X_test, y_test,\n cats=['Sex', 'Deck', 'Embarked'],\n descriptions=feature_descriptions,\n labels=['Not survived', 'Survived'])\n\n# Run\n#ExplainerDashboard(explainer).run()\n"
12 """
13 # Libraries
14 from sklearn.ensemble import RandomForestClassifier
15 from explainerdashboard import ClassifierExplainer
16 from explainerdashboard import ExplainerDashboard
17 from explainerdashboard.datasets import titanic_survive
18 from explainerdashboard.datasets import feature_descriptions
19
20 # Get data
21 X_train, y_train, X_test, y_test = titanic_survive()
22
23 # Create and fit model
24 model = RandomForestClassifier(n_estimators=50, max_depth=10) \
25 .fit(X_train, y_train)
26
27 # Configure explainer
28 explainer = ClassifierExplainer(model, X_test, y_test,
29 cats=['Sex', 'Deck', 'Embarked'],
30 descriptions=feature_descriptions,
31 labels=['Not survived', 'Survived'])
32
33 # Run
34 #ExplainerDashboard(explainer).run()
35 """
Total running time of the script: ( 0 minutes 0.004 seconds)