In TF 2.2.0-rc1, validation_data expects tuples, not lists, fixes #131
parent
7b3d280a86
commit
6adb7253b5
|
@ -592,7 +592,7 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"nadam\", metrics=[\"accuracy\"])\n",
|
||||
"history = model.fit(X_train, y_train, epochs=10, validation_data=[X_valid, y_valid])\n",
|
||||
"history = model.fit(X_train, y_train, epochs=10, validation_data=(X_valid, y_valid))\n",
|
||||
"score = model.evaluate(X_test, y_test)\n",
|
||||
"X_new = X_test[:10] # pretend we have new images\n",
|
||||
"y_pred = model.predict(X_new)"
|
||||
|
@ -1306,7 +1306,7 @@
|
|||
"model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"nadam\",\n",
|
||||
" metrics=[\"accuracy\"])\n",
|
||||
"\n",
|
||||
"model.fit(X_train, y_train, epochs=10, validation_data=[X_valid, y_valid])\n",
|
||||
"model.fit(X_train, y_train, epochs=10, validation_data=(X_valid, y_valid))\n",
|
||||
"model.evaluate(X_test, y_test)"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -282,7 +282,7 @@
|
|||
"stacked_ae.compile(loss=\"binary_crossentropy\",\n",
|
||||
" optimizer=keras.optimizers.SGD(lr=1.5), metrics=[rounded_accuracy])\n",
|
||||
"history = stacked_ae.fit(X_train, X_train, epochs=20,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -448,7 +448,7 @@
|
|||
"tied_ae.compile(loss=\"binary_crossentropy\",\n",
|
||||
" optimizer=keras.optimizers.SGD(lr=1.5), metrics=[rounded_accuracy])\n",
|
||||
"history = tied_ae.fit(X_train, X_train, epochs=10,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -488,7 +488,7 @@
|
|||
" autoencoder = keras.models.Sequential([encoder, decoder])\n",
|
||||
" autoencoder.compile(optimizer, loss, metrics=metrics)\n",
|
||||
" autoencoder.fit(X_train, X_train, epochs=n_epochs,\n",
|
||||
" validation_data=[X_valid, X_valid])\n",
|
||||
" validation_data=(X_valid, X_valid))\n",
|
||||
" return encoder, decoder, encoder(X_train), encoder(X_valid)"
|
||||
]
|
||||
},
|
||||
|
@ -545,7 +545,7 @@
|
|||
"stacked_ae_1_by_1.compile(loss=\"binary_crossentropy\",\n",
|
||||
" optimizer=keras.optimizers.SGD(lr=0.1), metrics=[rounded_accuracy])\n",
|
||||
"history = stacked_ae_1_by_1.fit(X_train, X_train, epochs=10,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -602,7 +602,7 @@
|
|||
"conv_ae.compile(loss=\"binary_crossentropy\", optimizer=keras.optimizers.SGD(lr=1.0),\n",
|
||||
" metrics=[rounded_accuracy])\n",
|
||||
"history = conv_ae.fit(X_train, X_train, epochs=5,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -658,7 +658,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"history = recurrent_ae.fit(X_train, X_train, epochs=10, validation_data=[X_valid, X_valid])"
|
||||
"history = recurrent_ae.fit(X_train, X_train, epochs=10, validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -709,7 +709,7 @@
|
|||
"denoising_ae.compile(loss=\"binary_crossentropy\", optimizer=keras.optimizers.SGD(lr=1.0),\n",
|
||||
" metrics=[rounded_accuracy])\n",
|
||||
"history = denoising_ae.fit(X_train, X_train, epochs=10,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -757,7 +757,7 @@
|
|||
"dropout_ae.compile(loss=\"binary_crossentropy\", optimizer=keras.optimizers.SGD(lr=1.0),\n",
|
||||
" metrics=[rounded_accuracy])\n",
|
||||
"history = dropout_ae.fit(X_train, X_train, epochs=10,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -811,7 +811,7 @@
|
|||
"simple_ae.compile(loss=\"binary_crossentropy\", optimizer=keras.optimizers.SGD(lr=1.),\n",
|
||||
" metrics=[rounded_accuracy])\n",
|
||||
"history = simple_ae.fit(X_train, X_train, epochs=10,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -924,7 +924,7 @@
|
|||
"sparse_l1_ae.compile(loss=\"binary_crossentropy\", optimizer=keras.optimizers.SGD(lr=1.0),\n",
|
||||
" metrics=[rounded_accuracy])\n",
|
||||
"history = sparse_l1_ae.fit(X_train, X_train, epochs=10,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1020,7 +1020,7 @@
|
|||
"sparse_kl_ae.compile(loss=\"binary_crossentropy\", optimizer=keras.optimizers.SGD(lr=1.0),\n",
|
||||
" metrics=[rounded_accuracy])\n",
|
||||
"history = sparse_kl_ae.fit(X_train, X_train, epochs=10,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1100,7 +1100,7 @@
|
|||
"variational_ae.add_loss(K.mean(latent_loss) / 784.)\n",
|
||||
"variational_ae.compile(loss=\"binary_crossentropy\", optimizer=\"rmsprop\", metrics=[rounded_accuracy])\n",
|
||||
"history = variational_ae.fit(X_train, X_train, epochs=25, batch_size=128,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1454,7 +1454,7 @@
|
|||
"])\n",
|
||||
"classifier.compile(loss=\"sparse_categorical_crossentropy\", optimizer=keras.optimizers.SGD(lr=0.02),\n",
|
||||
" metrics=[\"accuracy\"])\n",
|
||||
"history = classifier.fit(X_train_small, y_train_small, epochs=20, validation_data=[X_valid, y_valid])"
|
||||
"history = classifier.fit(X_train_small, y_train_small, epochs=20, validation_data=(X_valid, y_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1498,7 +1498,7 @@
|
|||
" optimizer=keras.optimizers.SGD(lr=0.02),\n",
|
||||
" metrics=[\"accuracy\"])\n",
|
||||
"history = pretrained_clf.fit(X_train_small, y_train_small, epochs=30,\n",
|
||||
" validation_data=[X_valid, y_valid])"
|
||||
" validation_data=(X_valid, y_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1514,7 +1514,7 @@
|
|||
" optimizer=keras.optimizers.SGD(lr=0.02),\n",
|
||||
" metrics=[\"accuracy\"])\n",
|
||||
"history = pretrained_clf.fit(X_train_small, y_train_small, epochs=20,\n",
|
||||
" validation_data=[X_valid, y_valid])"
|
||||
" validation_data=(X_valid, y_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1548,7 +1548,7 @@
|
|||
"hashing_ae.compile(loss=\"binary_crossentropy\", optimizer=keras.optimizers.SGD(lr=1.0),\n",
|
||||
" metrics=[rounded_accuracy])\n",
|
||||
"history = hashing_ae.fit(X_train, X_train, epochs=10,\n",
|
||||
" validation_data=[X_valid, X_valid])"
|
||||
" validation_data=(X_valid, X_valid))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue