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
in Chapter 10, there is this piece of code about (conditionally) using a normalization layer within the .fit() method of a kt.HyperModel:
classMyClassificationHyperModel(kt.HyperModel):
defbuild(self, hp):
returnbuild_model(hp)
deffit(self, hp, model, X, y, **kwargs):
ifhp.Boolean("normalize"):
norm_layer=tf.keras.layers.Normalization()
X=norm_layer(X)
returnmodel.fit(X, y, **kwargs)
My question is, shouldn't we call the .adapt() method of the Normalization layer before calling .fit()?
Also, I have found that using hp.Boolean() directly inside the .fit() method results in the normalize hyperparameter always being equal to False. If I initialize the parameter in the build() method instead and then use it inside fit(), then it can be either True or False during the search:
Hi,
in Chapter 10, there is this piece of code about (conditionally) using a normalization layer within the .
fit()
method of akt.HyperModel
:My question is, shouldn't we call the
.adapt()
method of the Normalization layer before calling.fit()
?Also, I have found that using
hp.Boolean()
directly inside the .fit() method results in thenormalize
hyperparameter always being equal toFalse
. If I initialize the parameter in thebuild()
method instead and then use it inside fit(), then it can be eitherTrue
orFalse
during the search:Versions:
OS: MacOSX 14.4.1
Python: 3.10.7
TensorFlow: 2.14
Keras-tuner: 1.4.7
Scikit-Learn: 1.14.1.post1
The text was updated successfully, but these errors were encountered: