'convert from sentiment labels confidence to score

as a beginner was checking for some sentiment analysis apis and found that google cloud returns a single sentiment value whereas aws returns 3 labels confidence. Is there any way to convert the sentiment labels confidence from something like this {'positive': 0.94, 'neutral': 0.02, 'negative': 0.04} to a single sentiment score, a float value? thx



Solution 1:[1]

The common approach is to subtract the negative label score from the positive label score (no need for neutral). As follows:

final_score = positive_score - negative_score

The final score ? [-1, 1], -1 being very negative and 1 very positive.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HLeb