Hi,
Can someone please explain the actual results we get as raw outputs and what are it's range?
The following are the results I am getting as raw output features.
[[ 2.3422227 0.04336229 -0.7625307 -2.8956182 ]
[-1.1994745 6.9426236 -1.8545047 -3.119325 ]
[ 6.8584485 -2.2693088 -3.3302417 -3.4118474 ]
[ 6.5169826 -2.4898453 -3.148984 -3.0034273 ]
[-1.9056513 0.6704526 3.7555788 -1.8298897 ]
[ 6.6204324 -1.4047363 -2.4027085 -4.5800114 ]
[-1.0606726 5.4772515 1.3901057 -4.785892 ]
[ 6.927998 -2.0280929 -3.284417 -3.7614038 ]
[ 6.141445 -1.2969164 -2.7105436 -4.2589316 ]
[ 6.8645945 -2.3979468 -2.797596 -3.737698 ]]
Heya,
assuming that this is the output of a ClassificationModel or similar you can apply the Softmax function to get the raw probabilities.
from scipy.special import softmax
import numpy
numpy.array([softmax(element) for element in your_probability_array[1]])
The resulting array then holds the probability for each label in your data set, i.e. [0] is the probability for label 0, [1] the probability for label 1, etc. with 1.00 being equal to 100% and 0.00 being equal to 0%.
Thank you so much!
Yes its from the Multi Class Classification model
I am assuming I should pass every raw output array to the softmax function separately and not the whole resulting matrix as one, right?
@chrzyki The results which I am getting with the regression model has value greater than 1 where as all my labels are between 0 and 1. Can you help please?
@ShivamSharma1997 can you show us a minimal example of your raw outputs and the code you're using for applying the softmax function?
@chrzyki The following is the code for getting the softmax values for each output. Each output in the raw_outputs list is a vector of length 25.
_, raw_outputs = model.predict(text_list)
predictions = []
for output in raw_outputs:
weights = softmax(output)
predictions.append(weights)
but I think this is working fine. I am confused about the output of the regression model, should I pass every output through the softmax function?
The predictions for the regression models are as follows:
0.4002847969532013
0.35405269265174866
0.2953510582447052
0.2686978876590729
0.4050685167312622
0.4273129999637604
0.4273129999637604
0.2625053822994232
0.4580164849758148
0.2639479637145996
@ShivamSharma1997 for every item of every list of outputs (i.e. label probabilities) you should apply the softmax function. The result should be a list of probabilities of labels for each element in text_list. Judging from your code, predictions should then be a list of list of probabilities.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi @chrzyki
Can you tell me a way to get the probabilities for each label for Multi-Label classification task?
Most helpful comment
Heya,
assuming that this is the output of a
ClassificationModelor similar you can apply the Softmax function to get the raw probabilities.The resulting array then holds the probability for each label in your data set, i.e.
[0]is the probability for label0,[1]the probability for label1, etc. with1.00being equal to100%and0.00being equal to0%.