We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 881a66a commit b7454c2Copy full SHA for b7454c2
examples/text-classification/fasttext/fasttext.ipynb
@@ -625,7 +625,7 @@
625
"\n",
626
"import fasttext\n",
627
"import pickle\n",
628
- "\n",
+ "import numpy as np\n",
629
630
"from pathlib import Path\n",
631
"from typing import List\n",
@@ -646,7 +646,10 @@
646
" def predict_proba(self, input_data_df: pd.DataFrame):\n",
647
" \"\"\"Makes predictions with the model. Returns the class probabilities.\"\"\"\n",
648
" text_column = input_data_df.columns[0]\n",
649
- " return input_data_df[text_column].apply(self._predict_row)\n",
+ " \n",
650
+ " preds = input_data_df[text_column].apply(self._predict_row)\n",
651
652
+ " return np.stack(preds.values)\n",
653
654
" def _predict_row(self, text: str) -> List[float]:\n",
655
" text = text.replace(\"\\n\",\" \")\n",
0 commit comments