autonomio / talos

Hyperparameter Experiments with TensorFlow and Keras
https://autonom.io
MIT License
1.62k stars 268 forks source link

list input AttributeError: 'list' object has no attribute 'max' #353

Closed sarmadm closed 5 years ago

sarmadm commented 5 years ago

Hi

I'm using below model with talos :

my input is alist of sevent arrays like this

`X_train = [ f0_train_tw, f1_train_tw, f2_train_tw, f3_train_tw , f4_one_tr, f5_train_preds , f6_train]

Y_train = [Y_oh_tr, Ymrs_train, Y_oh_tr]

and test

X_test = [ f0_test_tw, f1_test_tw, f2_test_tw, f3_test_tw , f4_test_tr, f5_test_preds , f6_test]

Y_train = [Y_oh_tr, Ymrs_train, Y_oh_tr]

def my_model( x_train, y_train, x_val, y_val, params ): . . .

loss = dict(
    m_out_reg= 'mse',
    out_bias   = 'categorical_crossentropy',
    out_reg2clf= 'categorical_crossentropy'
)
metrics = dict(
    m_out_reg = 'mae',
    out_bias  = 'accuracy',
    out_reg2clf = 'accuracy'

)
loss_weights = dict(
       m_out_reg = 20,
       out_bias   = 1,
       out_reg2clf=1

)
model.compile(optimizer=opti, loss=loss, metrics=metrics, loss_weights=loss_weights)

pth_r = 'drive/Colab_Notebooks/dnn_logs/5400/checkpoint_r_con_seq_rnn.hdf5'
pth_c = 'drive/Colab_Notebooks/dnn_logs/5400/checkpoint_c_con_seq_rnn.hdf5'
pth_r2c = 'drive/Colab_Notebooks/dnn_logs/5400/checkpoint_r2c_con_seq_rnn.hdf5'

reduceLR = ReduceLROnPlateau(monitor='loss', factor=0.42, patience=9, verbose=1, mode='auto', cooldown=10)
chkpt_c = ModelCheckpoint(pth_c, monitor='val_out_bias_acc', mode='max', verbose=2, save_best_only=True, save_weights_only=True, period=1)
chkpt_r = ModelCheckpoint(pth_r, monitor='val_m_out_reg_mean_absolute_error', mode='min', verbose=2, save_best_only=True, save_weights_only=True, period=1)
chkpt_r2c = ModelCheckpoint(pth_r2c, monitor='val_out_reg2clf_acc', mode='max', verbose=2, save_best_only=True, save_weights_only=True, period=1)

out = model.fit( x= [X_train[0] ,X_train[1],X_train[2] ,X_train[3] ,X_train[4] ,X_train[5] ,X_train[6]]
                , y=Y_train,
                epochs=150,
                batch_size=params['batch_size'],

                validation_data = [[X_test[0] ,X_test[1] ,X_test[2] ,X_test[3] ,X_test[4] ,X_test[5] ,X_test[6]], Y_test],

                callbacks = [chkpt_r, chkpt_c, chkpt_r2c, reduceLR] , class_weight =class_weight)

`

Then I call talos like this :

ta.Scan(X_train, Y_train , p, input_model, x_val=X_test , y_val=Y_test )

I get this error :

`AttributeError Traceback (most recent call last)

in () 1 import talos as ta 2 ----> 3 ta.Scan(X_train, Y_train , p,build_mdl , x_val=X_test , y_val=Y_test ) 2 frames /usr/local/lib/python3.6/dist-packages/talos/scan/Scan.py in __init__(self, x, y, params, model, dataset_name, experiment_no, x_val, y_val, val_split, shuffle, round_limit, grid_downsample, random_method, seed, search_method, reduction_method, reduction_interval, reduction_window, reduction_threshold, reduction_metric, reduce_loss, last_epoch_value, clear_tf_session, disable_progress_bar, print_params, debug) 168 # input parameters section ends 169 --> 170 self._null = self.runtime() 171 172 def runtime(self): /usr/local/lib/python3.6/dist-packages/talos/scan/Scan.py in runtime(self) 172 def runtime(self): 173 --> 174 self = scan_prepare(self) 175 self = scan_run(self) /usr/local/lib/python3.6/dist-packages/talos/scan/scan_prepare.py in scan_prepare(self) 56 57 # create the data asset ---> 58 self.y_max = self.y.max() 59 self = validation_split(self) 60 self.shape = classify(self.y) AttributeError: 'list' object has no attribute 'max'` Plesae help to fix
mikkokotila commented 5 years ago

Maybe this is useful for you #154. Once that is resolved, also your case is resolved.

mikkokotila commented 5 years ago

This is now resolved in daily dev. See #154 for more details. Closing here.