autonomio / talos

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

Evaluating with autom8 #352

Closed tristankr closed 4 years ago

tristankr commented 5 years ago

I'm getting this error when trying to evaluate with autom8.

AxisError: axis 1 is out of bounds for array of dimension 1

mikkokotila commented 5 years ago

Can you post the whole trace, and the commands you are running.

tristankr commented 5 years ago

Here is my model. I've splitted my dataset in to train, validate and used SMOTE oversampling strategy due to an imbalanced dataset.

Model

def binary_classifier(x_train, y_train, x_val, y_val, params):

model = Sequential()
model.add(Dense(params['first_neuron'], kernel_initializer = params['kernel_initializer'], input_dim=x_train.shape[1], activation=params['activation']))
model.add(Dropout(params['dropout']))

#hidden layers
for i in range(params['hidden_layers']):
    print (f"adding layer {i+1}")
    model.add(Dense(params['hidden_neuron'], activation=params['activation']))
    model.add(Dropout(params['dropout']))

model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer=params['optimizer'](lr=lr_normalizer(params['lr'], params['optimizer'])), metrics=['acc'],loss=params['losses'])

out = model.fit(x_train, y_train,
                epochs=params['epochs'],
                batch_size=params['batch_size'],
                validation_data=[x_val, y_val],
                verbose=0)

return out, model

p = { 'lr': (0.1, 1, 10), 'first_neuron': [34], 'activation': ['relu'], 'hidden_layers': [1,2], 'hidden_neuron': [34,68], 'batch_size': [10,20,30], 'kernel_initializer': ['uniform', 'glorot_uniform'], 'epochs': [100], 'dropout': (0, 0.5, 10), 'optimizer':[Nadam, Adam], 'losses': ['binary_crossentropy'] }

Scan

scan_object = ta.Scan(x=x_train, y=y_train, params=p, model=binary_classifier, dataset_name = 'exp_3', experiment_no= '3', grid_downsample=.01) scan_object_with_eval = ta.Autom8(scan_object, x_val, y_val) scan_object.data.to_csv('results.csv')

mikkokotila commented 5 years ago

Thanks, please post the full trace for the error as well.

mikkokotila commented 4 years ago

Icing this as information is missing, and no updates. Feel free to reopen if still relevant.