Do not use learning_phase anymore, just set training=True/False

main
Aurélien Geron 2019-05-09 10:39:02 +08:00
parent df100ffa9a
commit 107b90d9b3
1 changed files with 3 additions and 4 deletions

View File

@ -1828,8 +1828,7 @@
"metadata": {},
"outputs": [],
"source": [
"#with keras.backend.learning_phase_scope(1): # TODO: check https://github.com/tensorflow/tensorflow/issues/25754\n",
"# history = model.fit(X_train_scaled, y_train)"
"history = model.fit(X_train_scaled, y_train)"
]
},
{
@ -1855,8 +1854,8 @@
"metadata": {},
"outputs": [],
"source": [
"with keras.backend.learning_phase_scope(1): # TODO: check https://github.com/tensorflow/tensorflow/issues/25754\n",
" y_probas = np.stack([model.predict(X_test_scaled) for sample in range(100)])\n",
"y_probas = np.stack([model(X_test_scaled, training=True)\n",
" for sample in range(100)])\n",
"y_proba = y_probas.mean(axis=0)\n",
"y_std = y_probas.std(axis=0)"
]