问题
What I want to do is to generate a score of 0-100 based on the predictions of a three class classification model. For eg. The predict_proba of a 3 class logistic regression model gives me 3 probabilities x, y, z as shown below -
0 1 2
x y z
Now, I want to generate a score of 0-100 based on these probabilities, where 0 is closer to class 0 and 100 is closer to class 2.
回答1:
Try this:
prob['P']=(prob['1']*1+prob['2']*2)/2
prob['0'] is multiplied by 0, so you don't need it.
examples:
prob['0']=0.5, prob['1']=0.5, prob['2']=0==>prob['P']=0.25
prob['0']=0.75, prob['1']=0.25, prob['2']=0==>prob['P']=0.125
prob['0']=0.1, prob['1']=0.2, prob['2']=0.7==>prob['P']=0.8
prob['0']=0, prob['1']=0, prob['2']=1==>prob['P']=1
来源:https://stackoverflow.com/questions/57577489/convert-class-probabilities-of-a-multiclass-model-to-scores-in-range-0-100