Python으로 배우는 Explainable AI
Fouad Trad
Machine Learning Engineer




![원본 데이터셋에서 한 특성의 값이 [1, 2, 3, 4]였고 셔플 후 [4, 2, 1, 3]으로 바뀌는 모습을 보여주는 이미지. 셔플된 데이터셋을 ML 모델에 넣어 셔플 후 성능을 얻습니다.](https://assets.datacamp.com/production/repositories/6745/datasets/8941afd8450944dd95675cf114c800a0de3d511c/PI_2.png)


| GRE 점수 | TOEFL 점수 | 대학 평가 | SOP | LOR | CGPA | 합격 확률 | 합격 |
|---|---|---|---|---|---|---|---|
| 337 | 118 | 4 | 4.5 | 4.5 | 9.65 | 0.92 | 1 |
| 324 | 107 | 4 | 4 | 4.5 | 8.87 | 0.76 | 1 |
| 316 | 104 | 3 | 3 | 3.5 | 8 | 0.72 | 1 |
| 322 | 110 | 3 | 3.5 | 2.5 | 8.67 | 0.8 | 1 |
| 314 | 103 | 2 | 2 | 3 | 8.21 | 0.45 | 0 |
데이터는 다음에 있습니다:
X_train, y_train
from sklearn.neural_network import MLPClassifier model = MLPClassifier(hidden_layer_sizes=(10,10))model.fit(X_train, y_train)
from sklearn.inspection import permutation_importanceresult = permutation_importance(model,X_train, y_train,n_repeats=10,random_state=42,scoring='accuracy')print(result.importances_mean)
[0.16213568 0.13831658 0.10575377 0.10522613 0.11741206 0.20072864]
import matplotlib.pyplot as plt
plt.bar(X_train.columns,
result.importances_mean)

import matplotlib.pyplot as plt
plt.bar(X_train.columns,
result.importances_mean)

plt.bar(X_train.columns, np.abs(log_reg.coef_[0]))

Python으로 배우는 Explainable AI