'Sklearn OneVsRestClassifier Giving Multiple positive outputs
I have trained a model RandomForestModel in Sklearn for an multiclass classification task. I came across the OneVsRestModel to train for this task. Given below is a function I use to train and generate predictions which is just working fine. However, when I save and reload my trained model in some other file like any other trained model - my predictions do not make any sense. I expect one-hot outputs from it, but the model returns things like [0,1,1,0,0] etc. N_Classes = 5
Any hints on what I am missing or doing wrong?
def applyModel(clfr, X_, y_, xt, yt):
classifier = OneVsRestClassifier(globals()[clfr]())
trainedClf = classifier.fit(X_, y_)
y_score = trainedClf.predict(xt)
scor = trainedClf.score(xt, yt)*100
return y_score, yt, scor, trainedClf
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
