intial commit (forked from private repo)
This commit is contained in:
17
extracted_cells/cell16.py
Normal file
17
extracted_cells/cell16.py
Normal file
@ -0,0 +1,17 @@
|
||||
# LIME für Erklärbarkeit
|
||||
from lime import lime_tabular
|
||||
import random
|
||||
|
||||
# Erstelle einen LIME-Erklärer
|
||||
lime_explainer = lime_tabular.LimeTabularExplainer(
|
||||
X_train.values,
|
||||
feature_names=X_train.columns,
|
||||
class_names=['<=50K', '>50K'],
|
||||
mode='classification',
|
||||
random_state=42
|
||||
)
|
||||
|
||||
# Wähle ein zufälliges Beispiel aus den Testdaten
|
||||
random_idx = random.randint(0, len(X_test) - 1)
|
||||
instance_df = X_test.iloc[random_idx:random_idx+1]
|
||||
instance = instance_df.values[0] # Für LIME benötigen wir das Array
|
||||
Reference in New Issue
Block a user