When I try to predict with my model I get an Attribute error After I've created my model using keras sequential, I tried to start predicting on a small sample to see if it would work however I get this error and I have no idea why.


  error : AttributeError Traceback (most recent call last)
   in () ----> 1 example_results
  = model.predict(example_batch) AttributeError: 'NoneType' object has no attribute 'predict'


The code for my model can be found here :

https://colab.research.google.com/drive/1mxRIx5ufVsA0ljdTpL0Ud0qm2y39eyGX

I've done it using this method before but it refuses to work this time around.
In cell 10 of your notebook you write:

model = build_model() #Perfect


In cell 11 you write:

model = model.summary() #Uh oh!!


later you call

example_result = model.predict(example_batch) #model.summary() returns None


and python tells you


  AttributeError: 'NoneType' object has no attribute 'predict'


This is because you reassigned model in cell 11 to, well, nothing. You should remove the model = in cell 11 and your code will run perfectly!

redo cell 11 to read:

 model.summary()