Health-Informatics-UoN / lettuce

MIT License
2 stars 0 forks source link

Add precision metric #54

Closed kuraisle closed 1 week ago

kuraisle commented 1 month ago

Add a

class PrecisionMetric(InformationRetrievalMetric)

That calculates the precision of a result from an Information retrieval pipeline.

Tests

With the expected list of values

["banana", "apple", "orange", "pear"]

and the prediction

["banana", "apple", "orange", "pear"]

(or any subset of that prediction), PrecisionMetric.calculate(...) should return 1.0

With the prediction

["banana", "apple", "blackberry", "snozzberry"]

PrecisionMetric.calculate(...) should return 0.5