Note
Click here to download the full example code
Model ExplanationΒΆ
Out:
Running DummyClassifier()
accuracy: 0.406 recall_macro: 0.333 precision_macro: 0.135 f1_macro: 0.193
=== new best DummyClassifier() (using recall_macro):
accuracy: 0.406 recall_macro: 0.333 precision_macro: 0.135 f1_macro: 0.193
Running GaussianNB()
accuracy: 0.954 recall_macro: 0.958 precision_macro: 0.956 f1_macro: 0.956
=== new best GaussianNB() (using recall_macro):
accuracy: 0.954 recall_macro: 0.958 precision_macro: 0.956 f1_macro: 0.956
Running MultinomialNB()
accuracy: 0.940 recall_macro: 0.937 precision_macro: 0.954 f1_macro: 0.941
Running DecisionTreeClassifier(class_weight='balanced', max_depth=1)
accuracy: 0.579 recall_macro: 0.610 precision_macro: 0.441 f1_macro: 0.487
Running DecisionTreeClassifier(class_weight='balanced', max_depth=5)
accuracy: 0.903 recall_macro: 0.903 precision_macro: 0.911 f1_macro: 0.902
Running DecisionTreeClassifier(class_weight='balanced', min_impurity_decrease=0.01)
accuracy: 0.888 recall_macro: 0.889 precision_macro: 0.895 f1_macro: 0.887
Running LogisticRegression(C=0.1, class_weight='balanced', max_iter=1000)
accuracy: 0.985 recall_macro: 0.987 precision_macro: 0.985 f1_macro: 0.985
=== new best LogisticRegression(C=0.1, class_weight='balanced', max_iter=1000) (using recall_macro):
accuracy: 0.985 recall_macro: 0.987 precision_macro: 0.985 f1_macro: 0.985
Running LogisticRegression(class_weight='balanced', max_iter=1000)
accuracy: 0.985 recall_macro: 0.987 precision_macro: 0.985 f1_macro: 0.985
Best model:
LogisticRegression(C=0.1, class_weight='balanced', max_iter=1000)
Best Scores:
accuracy: 0.985 recall_macro: 0.987 precision_macro: 0.985 f1_macro: 0.985
precision recall f1-score support
0 0.95 1.00 0.97 18
1 1.00 0.88 0.94 17
2 0.91 1.00 0.95 10
accuracy 0.96 45
macro avg 0.95 0.96 0.95 45
weighted avg 0.96 0.96 0.95 45
[[18 0 0]
[ 1 15 1]
[ 0 0 10]]
/home/circleci/project/dabl/plot/utils.py:378: UserWarning: FixedFormatter should only be used together with FixedLocator
ax.set_yticklabels(
from dabl.models import SimpleClassifier
from dabl.explain import explain
from sklearn.datasets import load_wine
from sklearn.model_selection import train_test_split
wine = load_wine()
X_train, X_test, y_train, y_test = train_test_split(wine.data, wine.target)
sc = SimpleClassifier()
sc.fit(X_train, y_train)
explain(sc, X_test, y_test)
Total running time of the script: ( 0 minutes 1.199 seconds)