IndicoDataSolutions / finetune

Scikit-learn style model finetuning for NLP

Home Page:https://finetune.indico.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: unorderable types: float() > NoneType()

emtropyml opened this issue · comments

Inference: 100%|██████████| 1932/1932 [00:18<00:00, 106.11it/s]


TypeError Traceback (most recent call last)
in
1 mlb = MultiLabelBinarizer()
----> 2 predictions =model.predict(testX)
3 print(classification_report(mlb.fit_transform(testY),mlb.fit_transform(predictions)))
4 print(roc_auc_score(mlb.fit_transform(testY), pd.DataFrame(model.predict_proba(testX)).values, average=None))
5 print(roc_auc_score(mlb.fit_transform(testY), pd.DataFrame(model.predict_proba(testX)).values, average='micro'))

~/.local/lib/python3.5/site-packages/finetune/target_models/multi_label_classifier.py in predict(self, X, threshold)
59 # last chunk in a document
60 means = np.mean(doc_probs, axis=0)
---> 61 label = self.input_pipeline.label_encoder.inverse_transform(np.expand_dims(means, 0) > threshold)[0]
62 all_labels.append(list(label))
63 return all_labels

TypeError: unorderable types: float() > NoneType()

Thanks for the bug report. It seems it is not correctly using the threshold from config. We will push a fix as soon as possible but for now it should work if you call predict with the explicit keyword argument threshold= the default was previously 0.5.