<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def f_measure(reference_onsets, estimated_onsets, window=.05):
 """Compute the F-measure of correct vs incorrectly predicted onsets. "Corectness" is determined over a small window. Examples -------- Parameters reference_onsets : np.ndarray reference onset locations, in seconds estimated_onsets : np.ndarray estimated onset locations, in seconds window : float Window size, in seconds (Default value = .05) Returns ------- f_measure : float 2*precision*recall/(precision + recall) precision : float (# true positives)/(# true positives + # false positives) recall : float (# true positives)/(# true positives + # false negatives) """

    validate(reference_onsets, estimated_onsets)
    # If either list is empty, return 0s
    if reference_onsets.size == 0 or estimated_onsets.size == 0:
        return 0., 0., 0.
    # Compute the best-case matching between reference and estimated onset
    # locations
    matching = util.match_events(reference_onsets, estimated_onsets, window)

    precision = float(len(matching))/len(estimated_onsets)
    recall = float(len(matching))/len(reference_onsets)
    # Compute F-measure and return all statistics
    return util.f_measure(precision, recall), precision, recall