From e0cae0c7beaf144f138c486a39d693c03e8f89a0 Mon Sep 17 00:00:00 2001 From: Ian Beauregard Date: Mon, 19 Oct 2020 14:19:42 -0400 Subject: [PATCH] Replace deprecated method See https://www.tensorflow.org/api_docs/python/tf/keras/Sequential?hl=en#predict_classes. --- 16_nlp_with_rnns_and_attention.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/16_nlp_with_rnns_and_attention.ipynb b/16_nlp_with_rnns_and_attention.ipynb index b682c3e..f7baa44 100644 --- a/16_nlp_with_rnns_and_attention.ipynb +++ b/16_nlp_with_rnns_and_attention.ipynb @@ -353,7 +353,7 @@ "outputs": [], "source": [ "X_new = preprocess([\"How are yo\"])\n", - "Y_pred = model.predict_classes(X_new)\n", + "Y_pred = np.argmax(model.predict(X_new), axis=-1)\n", "tokenizer.sequences_to_texts(Y_pred + 1)[0][-1] # 1st sentence, last char" ] }, @@ -1785,7 +1785,7 @@ "metadata": {}, "outputs": [], "source": [ - "ids = model.predict_classes(X_new)\n", + "ids = np.argmax(model.predict(X_new), axis=-1)\n", "for date_str in ids_to_date_strs(ids):\n", " print(date_str)" ] @@ -1819,7 +1819,7 @@ "metadata": {}, "outputs": [], "source": [ - "ids = model.predict_classes(X_new)\n", + "ids = np.argmax(model.predict(X_new), axis=-1)\n", "for date_str in ids_to_date_strs(ids):\n", " print(date_str)" ] @@ -1847,7 +1847,7 @@ "\n", "def convert_date_strs(date_strs):\n", " X = prepare_date_strs_padded(date_strs)\n", - " ids = model.predict_classes(X)\n", + " ids = np.argmax(model.predict(X), axis=-1)\n", " return ids_to_date_strs(ids)" ] },