Explainable AI trong Python
Fouad Trad
Machine Learning Engineer




Mô hình đơn giản:
Mô hình phức tạp:

Hiển thị đường đi quyết định theo điều kiện

Hiển thị đường đi quyết định theo điều kiện

Hiển thị đường đi quyết định theo điều kiện

Không minh bạch theo thiết kế

Hiển thị đường đi quyết định theo điều kiện

Không minh bạch theo thiết kế

| Điểm GRE | Điểm TOEFL | Xếp hạng trường | SOP | LOR | CGPA | Nhận |
|---|---|---|---|---|---|---|
| 337 | 118 | 4 | 4.5 | 4.5 | 9.65 | 1 |
| 316 | 104 | 3 | 3 | 3.5 | 8.00 | 1 |
| 314 | 103 | 2 | 2 | 3 | 8.21 | 0 |
from sklearn.tree import DecisionTreeClassifier model = DecisionTreeClassifier(max_depth=5)model.fit(X_train, y_train)y_pred = model.predict(y_test)acc = accuracy_score(y_test, y_pred) print(f"Accuracy of Decision Tree: {acc}")
Accuracy of Decision Tree: 0.82
from sklearn.neural_network import MLPClassifier model = MLPClassifier(hidden_layer_sizes=(1000,1000))model.fit(X_train, y_train)y_pred = model.predict(y_test)acc = accuracy_score(y_test, y_pred) print(f"Accuracy of Neural Network: {acc}")
Accuracy of Neural Network: 0.9
from sklearn.tree export_text rules = export_text(model, feature_names=list(X_train.columns))print(rules)
|--- CGPA <= 8.34 | |--- GRE Score <= 320.50 | | |--- class: 0| |--- GRE Score > 320.50 | | |--- class: 1|--- CGPA > 8.34 | |--- GRE Score <= 319.50 | | |--- class: 1 ...
Áp dụng cho mô hình cụ thể

Áp dụng cho mô hình cụ thể

Áp dụng cho mọi mô hình


Explainable AI trong Python