Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error updating hyperparameters in "Best so far" #12

Open
senyang1107 opened this issue May 3, 2024 · 0 comments
Open

Error updating hyperparameters in "Best so far" #12

senyang1107 opened this issue May 3, 2024 · 0 comments

Comments

@senyang1107
Copy link

Hello, I found a hyperparameter error in the Best so far after using randomsearch. As you can see from the picture, when the num_layers = 11 in Best so far, we should expect unit_11=none, but the opposite is true. I don't know why this problem has occurred, and I really hope to get your help.
The relevant codes are as follows:
def build_model(hp):
model = keras.Sequential()
for i in range(hp.Int('num_layers', 1, 12)):
#model.add(layers.Dense(units=hp.Choice('units_' + str(i), values=[4,8,16,32,64,128,256,512]), activation='relu'))
model.add(layers.Dense(units=hp.Int('units_' + str(i), min_value=16,max_value=512,step=16), activation='relu'))
model.add(Dropout(rate=hp.Float('dropout_rate', min_value=0.0, max_value=0.5, step=0.1)))
batch_size = hp.Int('batch_size', min_value=4, max_value=64, step=4) #
model.add(Dense(1,kernel_initializer=initializer)) #
model.compile(optimizer='adam', loss='mean_squared_error', metrics=[keras.metrics.RootMeanSquaredError()])
return model

tuner_RandomSearch = inner_cv(RandomSearch)(
build_model,
KFold(n_splits=10, random_state=2024, shuffle=True),
save_output=True,
save_history=True,
objective=keras_tuner.Objective("val_root_mean_squared_error", direction="min"),
directory='DNN240503',
project_name='randomsearch_Int_L1_112',
seed=2024,
max_trials=100,
overwrite=True,
allow_new_entries=True,
)
my_callbacks = [
keras.callbacks.EarlyStopping(monitor='val_root_mean_squared_error',
patience=10, restore_best_weights=True)
]
tuner_RandomSearch.search(
train_validation_X.values,
train_validation_Y.values,
validation_split=0.25,
epochs=500,
callbacks=[my_callbacks],
verbose=True)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant