如何将 ELI5 保存explain_weights为explain_predictionpandas DataFrame?
下面的示例玩具代码。
# Load the dataset as DataFrame
import pandas as pd
from sklearn.datasets import load_iris
df = pd.DataFrame(load_iris().data, columns=load_iris().feature_names)
df['label'] = load_iris().target
# Divide to X and y and split to train and test sets
X = df.iloc[:,0:4].values
y = df.iloc[:,4].values
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
# Define the neural network model
from keras.models import Sequential
from keras.layers import Dense
def baseline_model():
model = Sequential() …Run Code Online (Sandbox Code Playgroud)