Score less than 0
giuseppeboezio opened this issue · 1 comments
I have the following problem: I have two short texts and I want to compute the BERTscore but I obtain for both precision, recall and F1-score a negative value. How is it possible? Is the score supposed to be between 0 and 1? I post the code to replicate the results:
def bertscore_f1_score(reference, candidate): """ BERTScore score, see https://github.com/huggingface/datasets/tree/master/metrics/bertscore for API Parameters: reference: reference translation candidate: generated translation Returns: BERTScore f1 score """ bertscore = load_metric("bertscore") result = bertscore.compute( predictions=[candidate], references=[reference], lang="en", rescale_with_baseline=True ) return result['f1'][0]
the main is:
reference = "All right guys now as y'all guys might know sometimes maybe she did have a little bit of interest but you just did some just went on a kilt that but a lot of times they don't even be that guys when you go up and get some of these women normal guys. Alright guys, so anytime a woman rejects you what she basically saying is you are not what I'm looking for because there's no such thing as a woman being off the market i period and for any of you guys go jump on your fucking soapbox talking shit if women approached me." candidate = "That's what she's seeking. She wants a man that's about two dollars that look out for her and a billionaire comes up and approached her and she knows he's a billionaire. Yo chick gonna be gone not that day. Not that day because she got to see what he's about. She gots to see his is he he just want to fuck one time. " f = bertscore_f1_score(reference, candidate) print(f)
Hi,
BERTSCore is based on cosine similarity, so it's by design between -1 and 1.