I have trained a Spacy nlp model with a 'spancat' model. For testing the model, I have added the code below for prediction of spans and label
nlp = spacy.load('output_/model-best')
rest = 'The book was of red colour'
doc1 = nlp(rest)
print(doc1.spans) #To get predicted span
span = doc1.spans['sc'][0]
print(span.label_) # to get label
How can I also get the confidence score for prediction of the spans?
You can get the score directly from the span group, using the
scores
attribute. For example: