Ian Beauregard 2020-10-19 14:19:42 -04:00
parent a2ffc37d2f
commit e0cae0c7be
1 changed files with 4 additions and 4 deletions

View File

@ -353,7 +353,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"X_new = preprocess([\"How are yo\"])\n", "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" "tokenizer.sequences_to_texts(Y_pred + 1)[0][-1] # 1st sentence, last char"
] ]
}, },
@ -1785,7 +1785,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "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", "for date_str in ids_to_date_strs(ids):\n",
" print(date_str)" " print(date_str)"
] ]
@ -1819,7 +1819,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "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", "for date_str in ids_to_date_strs(ids):\n",
" print(date_str)" " print(date_str)"
] ]
@ -1847,7 +1847,7 @@
"\n", "\n",
"def convert_date_strs(date_strs):\n", "def convert_date_strs(date_strs):\n",
" X = prepare_date_strs_padded(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)" " return ids_to_date_strs(ids)"
] ]
}, },