I have 2 functions that give out precision and recall scores, I need to make a harmonic mean function defined in the same library that uses these two scores. The functions looks
The following will work with any number of arguments:
def hmean(*args):
return len(args) / sum(1. / val for val in args)
To compute the harmonic mean of precision and recall, use:
result = hmean(precision, recall)
There are two problems with your function: