Skip to content

Can Talos Work with Unsupervised Learning on LSTM/Autoencoder Model #533

Description

@krwiegold

Hi, I am trying to use Talos to optimize the hyperparameters on an unsupervised LSTM/Autoencoder model. The model works without Talos. Since I do not have y data (no known labels / dependent variables), so I created my model as follows below. And the data input is called "scaled_data".

set parameters for Talos

p = {'optimizer': ['Nadam', 'Adam', 'sgd'],
'losses': ['binary_crossentropy', 'mse'],
'activation':['relu', 'elu']}

create autoencoder model

def create_model(X_input, y_input, params):
autoencoder = Sequential()
autoencoder.add(LSTM(12, input_shape=(scaled_data.shape[1], scaled_data.shape[2]), activation=params['activation'],
return_sequences=True, kernel_regularizer=tf.keras.regularizers.l2(0.01)))
autoencoder.add(LSTM(4, activation=params['activation']))
autoencoder.add(RepeatVector(scaled_data.shape[1]))
autoencoder.add(LSTM(4, activation=params['activation'], return_sequences=True))
autoencoder.add(LSTM(12, activation=params['activation'], return_sequences=True))
autoencoder.add(TimeDistributed(Dense(scaled_data.shape[2])))
autoencoder.compile(optimizer=params['optimizer'], loss=params['losses'], metrics=['acc'])

history = autoencoder.fit(X_input, y_input, epochs=10, batch_size=1, validation_split=0.0,
                          callbacks=[EarlyStopping(monitor='acc', patience=3)]).history

return autoencoder, history

scan_object = talos.Scan(x=scaled_data, y=scaled_data, params=p, model=create_model, experiment_name='LSTM')

My error says: TypeError: create_model() takes 3 positional arguments but 5 were given.

How am I passing 5 arguments? Any ideas how to fix this issue? I looked through the documents and other questions, but don't see anything with an unsupervised model. Thank you!

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions