You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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)
The text was updated successfully, but these errors were encountered: