File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
examples/text-classification/fasttext Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 625
625
" \n " ,
626
626
" import fasttext\n " ,
627
627
" import pickle\n " ,
628
- " \n " ,
628
+ " import numpy as np \n " ,
629
629
" \n " ,
630
630
" from pathlib import Path\n " ,
631
631
" from typing import List\n " ,
646
646
" def predict_proba(self, input_data_df: pd.DataFrame):\n " ,
647
647
" \"\"\" Makes predictions with the model. Returns the class probabilities.\"\"\"\n " ,
648
648
" text_column = input_data_df.columns[0]\n " ,
649
- " return input_data_df[text_column].apply(self._predict_row)\n " ,
649
+ " \n " ,
650
+ " preds = input_data_df[text_column].apply(self._predict_row)\n " ,
651
+ " \n " ,
652
+ " return np.stack(preds.values)\n " ,
650
653
" \n " ,
651
654
" def _predict_row(self, text: str) -> List[float]:\n " ,
652
655
" text = text.replace(\"\\ n\" ,\" \" )\n " ,
You can’t perform that action at this time.
0 commit comments