def build_v1(hp: kt.HyperParameters, base_feature_size: int = 0): spectral_size = hp.Choice("spectral_size", values=[8, 16, 32, 64], ordered=True) dropout_rate = hp.Float("dropout_rate", 0.0, 0.8, step=0.1) output_units = hp.Choice("embedding_size", [8, 16, 32, 64, 128], ordered=True) hidden_units = hp.Choice("hidden_units", values=[32, 64, 128, 256, 512], ordered=True) hidden_layers = hp.Int("hidden_layers", min_value=1, max_value=3) spec = tf.TensorSpec( ( None, spectral_size + base_feature_size, ), dtype=tf.float32, ) model = core.sgae( spec, functools.partial( mlp, output_units=output_units, hidden_units=(hidden_units, ) * hidden_layers, dropout_rate=dropout_rate, ), ) _compile(hp, model) return model
def Float( hp: kt.HyperParameters, name: str, min_value: float, max_value: float, step: tp.Optional[float] = None, sampling: tp.Optional[str] = None, default: tp.Optional[float] = None, parent_name: tp.Optional[str] = None, parent_values=None, ): return hp.Float( name=name, min_value=min_value, max_value=max_value, step=step, sampling=sampling, default=default, parent_name=parent_name, parent_values=parent_values, )
"LSTM", { "units": DEFAULT_HP.Int(name='units', min_value=32, max_value=128, step=32, default=64), "return_sequences": False, "kernel_initializer": "glorot_uniform", "activation": DEFAULT_HP.Choice(name='LSTM_1_activation', values=['relu', 'tanh', 'sigmoid', "linear"], default='relu'), } ], [ "Dropout", { "rate": DEFAULT_HP.Float(name='dropout', min_value=0.0, max_value=0.5, default=0.2, step=0.05) } ], ["Dense", { "activation": "linear" }]] }