Autokeras: Save top 3 best models

Created on 2 Jul 2020  路  6Comments  路  Source: keras-team/autokeras

I want to save not just one but the top 3 best performing models created by AutoKeras. I want to analyze the differences between them. How can I save them?

feature request wontfix

Most helpful comment

@abdulsam You can use a for loop to do so.

for index, model in enumerate(AutoModel.tuner.get_best_models(3)):
  model.save('model' + str(index) + '.h5')

All 6 comments

You can use AutoModel.tuner.get_best_models(3)

You can use AutoModel.tuner.get_best_models(3)

This will enlist the best 3 models. I want to save these models or export them. Is there any way to do this?

@abdulsam You can use a for loop to do so.

for index, model in enumerate(AutoModel.tuner.get_best_models(3)):
  model.save('model' + str(index) + '.h5')

@haifeng-jin While loading the saved models, it is giving a warning
WARNING:tensorflow:Error in loading the saved optimizer state. As a result, your model is starting with a freshly initialized optimizer.

I ignored this warning because I can train it again. But while using fit() method on the loaded model, it is showing this error:
ValueError: Shapes (None, 1) and (None, 10) are incompatible

I guess it is because of the label encoding? We do a one-hot encoding for the labels under the hood.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vincent-hui picture vincent-hui  路  5Comments

mlaradji picture mlaradji  路  4Comments

touching-foots-huskie picture touching-foots-huskie  路  4Comments

kmbmjn picture kmbmjn  路  6Comments

mark-watson picture mark-watson  路  5Comments