Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise2-Answer.ipynb: it should get acc instead of accuracy #96

Open
yohei1126 opened this issue Apr 28, 2020 · 2 comments
Open

Exercise2-Answer.ipynb: it should get acc instead of accuracy #96

yohei1126 opened this issue Apr 28, 2020 · 2 comments

Comments

@yohei1126
Copy link

class myCallback(tf.keras.callbacks.Callback):
  def on_epoch_end(self, epoch, logs={}):
    if(logs.get('accuracy')>0.6):
      print("\nReached 60% accuracy so cancelling training!")
      self.model.stop_training = True

This does not work. logs.get('accuracy') always returns None.
It should be

class myCallback(tf.keras.callbacks.Callback):
  def on_epoch_end(self, epoch, logs={}):
    if(logs.get('acc')>0.6):
      print("\nReached 60% accuracy so cancelling training!")
      self.model.stop_training = True
@p14jeffwest
Copy link

Yes, I had a sames result.
logs.get('accuracy') made error but logs.get('acc') is ok.

@geetanjaligg
Copy link

This is because of Tensorflow 1. If you upgrade it to Tensorflow 2, 'accuracy' should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants