Closed lenka-cizkova closed 2 years ago
Thank you for noting this.
Will check it out properly this week.
The updated plot_decision_boundary()
function should work in the notebook here now: https://github.com/mrdbourke/tensorflow-deep-learning/blob/main/02_neural_network_classification_in_tensorflow.ipynb
We are doing binary classification, expecting the predictions to be 0 or 1. For
model_2
, the shape ofmodel_2.predict(X)
is (1000, 1), i.e., for each input row we get a scalar result. However, the first layer in the TF 2.7.0+ tweak tomodel_3
,tf.keras.layers.Dense(100, input_shape=(None, 1))
seems to be wrong: the shape of
model_3.predict(X)
is (1000, 2, 1), i.e., for each input row we now get 2 numbers. This is also indicated by the functionplot_decision_boundary()
, saying 'doing multiclass classification...' and showing different contours than those shown in the video.Based on the documentation of Dense and Input, I believe that the
input_shape
should be (2,), i.e., usingtf.keras.layers.Dense(100, input_shape=(2,))
or we can just keep the model as it was originally, with
tf.keras.layers.Dense(100)
This throws no errors and produces the same plot as shown in the video, with 'doing binary classification'.
Compare the original plot to the plot corresponding to the tweaked version: