NLeSC / mcfly-tutorial

tutorial for mcfly repository
Apache License 2.0
77 stars 40 forks source link

ValueError: Invalid metric: "accuracy" is not among the metrics the models was compiled with ([]). #42

Closed jmrichardson closed 4 years ago

jmrichardson commented 4 years ago

Hi, I am getting an error when executing this tutorial:

outputfile = os.path.join(resultpath, 'modelcomparison.json')
histories, val_accuracies, val_losses = mcfly.find_architecture.train_models_on_samples(X_train, y_train_binary,
                                                                           X_val, y_val_binary,
                                                                           models,nr_epochs=5,
                                                                           subset_size=300,
                                                                           verbose=True,
                                                                           outputfile=outputfile,
                                                                            metric=metric)
print('Details of the training process were stored in ',outputfile)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-24-25f24a279522> in <module>
      6                                                                            verbose=True,
      7                                                                            outputfile=outputfile,
----> 8                                                                             metric=metric)
      9 print('Details of the training process were stored in ',outputfile)

D:\Anaconda3\lib\site-packages\mcfly\find_architecture.py in train_models_on_samples(X_train, y_train, X_val, y_val, models, nr_epochs, subset_size, verbose, outputfile, model_path, early_stopping_patience, batch_size, metric, class_weight)
    115         if metric_name not in model_metrics:
    116             raise ValueError('Invalid metric: "{}" is not among the metrics the models was compiled with ({}).'
--> 117                              .format(metric_name, model_metrics))
    118         if early_stopping_patience is not None:
    119             if early_stopping_patience == 'auto':

ValueError: Invalid metric: "accuracy" is not among the metrics the models was compiled with ([]).
dafnevk commented 4 years ago

This error is fixed in release 3.1.0 of mcfly