0
$\begingroup$

I'm using the NearestCentroidClassifier combined with TF-IDF for classification of documents. The are linked to a growing number of document groups. I've set sklearns TfIdfVectorizer and the NearestCentroid classifier up and got it going.

But instead of a hard classification which spits out only a single label I'm more interested into having 'suggestions'. For example the 3 document groups that are most relevant for a document should be chosen and given as result.

The NearestCentroid classifier does not implement a 'predict_proba' function which I'd need for this. But I guess you can add it by hand (https://stackoverflow.com/questions/52592434/decision-boundaries-for-nearest-centroid/52593267)

So far so good, my problem is now that the 'score' function of the NearestCentroid classifier is using the 'predict' function and not the 'predict_proba' (which I would also need to give a number of 'suggestions'). I guess I could use the DIY 'predict_proba' function and build my own testing suite around that.

But I just would like to know if there is a more elegant way of dealing with this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.