#NEWLINE# def threshold( self , data , recall_weight = 1.5 ) : #NEWLINE# #INDENT# '\n        Returns the threshold that maximizes the expected F score,\n        a weighted average of precision and recall for a sample of\n        data.\n\n        Arguments:\n        data          -- Dictionary of records, where the keys are record_ids\n                         and the values are dictionaries with the keys being\n                         field names\n\n        recall_weight -- Sets the tradeoff between precision and\n                         recall. I.e. if you care twice as much about\n                         recall as you do precision, set recall_weight\n                         to 2.\n        ' #NEWLINE# blocked_pairs = self . _blockData ( data ) #NEWLINE# return self . thresholdBlocks ( blocked_pairs , recall_weight )