0
$\begingroup$

I am trying to figure out the best way to calculate the probability a sentence belongs to some category. For simplicity sake, lets assume that the sentence is "yellow fruit". Next, I use the an BERT classifier to get a classification result [-5,1,2] with the categories [apple, orange, banana].

The array simply tells us how strong is the signal that corresponds to a category. In this case -5 for apple, 1 for orange, and 2 for banana. The answer to this classification is "banana" since 2 is the max number in the [-5,1,2] array, and it position corresponds to the category "banana". Therefore, we know that "yellow fruit" is most-likely a banana.

Next, I have a table of likelihood of purchase for apples, oranges and bananas:

Apple: 80%

Orange: 10%

Banana: 50%

I need to calculate the likelihood of customer purchase for sentence "yellow fruit". Therefore, I am given the sentence "yellow fruit", the classification vector [-5,1,2] the classification categories [apple, orange, banana] and the likelihood table for purchase [0.8,0.1,0.5]

How do I calculate the the likelihood of purchase for the sentence "yellow fruit" ?

$\endgroup$

1 Answer 1

2
$\begingroup$

To transform your logits [-5,1,2] into probabilities you can use the softmax function. This would get you p = [0.000666195, 0.268762254, 0.730571551].

$\endgroup$
0

Not the answer you're looking for? Browse other questions tagged .