Permutation importance for MLPClassifier
Your task is to use permutation importance to identify which features are most impactful in predicting heart disease with an MLPClassifier.
X containing the features and y containing the labels have been pre-loaded for you. matplotlib.pyplot has been imported as plt.
Deze oefening maakt deel uit van de cursus
Explainable AI in Python
Oefeninstructies
- Compute the permutation importance with 10 repeats using a
random_stateof 1. - Plot feature importances with a bar plot.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
from sklearn.neural_network import MLPClassifier
from sklearn.inspection import permutation_importance
model = MLPClassifier(hidden_layer_sizes=(10), random_state=1)
model.fit(X, y)
# Compute the permutation importance
result = ____
# Plot feature importances
____
plt.xticks(rotation=45)
plt.show()