def F(classify=(lambda document: False), documents=[], beta=1, average=None):
 (A, P, R, F1) = test(classify, documents, average)
 return (((((beta ** 2) + 1) * P) * R) / ((((beta ** 2) * P) + R) or 1))

def F ( classify = ( lambda document : False ) , documents = [ ] , beta = 1 , average = None ) : ( A , P , R , F1 ) = test ( classify , documents , average ) return ( ( ( ( ( beta ** 2 ) + 1 ) * P ) * R ) / ( ( ( ( beta ** 2 ) * P ) + R ) or 1 ) )
returns the weighted harmonic mean of precision and recall .