# Assuming your dataset is a pandas DataFrame named 'encoded_loan_df'
X = loan_data_df.drop('not.fully.paid', axis=1)
y = loan_data_df['not.fully.paid']

# Split the dataset into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42, stratify=y)

# Create a StandardScaler instance
scaler = StandardScaler()

# Fit the StandardScaler with the training data
X_scaler = scaler.fit(X_train)

# Scale the training and testing sets
X_train_scaled = X_scaler.transform(X_train)
X_test_scaled = X_scaler.transform(X_test)

def create_model(learning_rate, layer1_units, layer1_dropout, layer2_units, layer2_dropout, l1_l2_regularizer):
    model = Sequential()
    model.add(Dense(layer1_units, activation='relu', input_shape=(X_train_scaled.shape[1],), kernel_regularizer=L1L2(l1=l1_l2_regularizer, l2=l1_l2_regularizer)))
    model.add(Dropout(layer1_dropout))
    model.add(Dense(layer2_units, activation='relu', kernel_regularizer=L1L2(l1=l1_l2_regularizer, l2=l1_l2_regularizer)))
    model.add(Dropout(layer2_dropout))
    model.add(Dense(1, activation='sigmoid'))
    
    model.compile(optimizer=NAME_1(learning_rate=learning_rate), loss='binary_crossentropy', metrics=['accuracy'])
    return model

# Wrap the model creation function with KerasRegressor
model = tensorflow.keras.wrappers.scikit_learn.KerasClassifier(build_fn=lambda: create_model(learning_rate=0.001, layer1_units=128, layer1_dropout=0.1, layer2_units=64, layer2_dropout=0.1, l1_l2_regularizer=0.001), verbose=0)
# Create a