parameters: (y, y_pred, num_prunes)
return_statement: return single_cutoff(optimal_cutoffs)
docstring: Evaluates possible cutoff values using accuracy as the metric.
      If more than 1 cutoff gives the highest accuracy the midpoint
      between the min and max cutoff is used.
docstring_summary: Evaluates possible cutoff values using accuracy as the metric.
      If more than 1 cutoff gives the highest accuracy the midpoint
      between the min and max cutoff is used.
docstring_tokens: Evaluates possible cutoff values using accuracy as the metric . If more than 1 cutoff gives the highest accuracy the midpoint between the min and max cutoff is used .
function: def find_optimal_cutoff(y, y_pred, num_prunes):
      """Evaluates possible cutoff values using accuracy as the metric.
      If more than 1 cutoff gives the highest accuracy the midpoint
      between the min and max cutoff is used."""
      max_accuracy = 0
      optimal_cutoffs = []
  
      possibles = possible_cutoffs(y_pred)
      for test_cutoff in possibles:
          accuracy, _, _ = accuracy_per_tag(y, y_pred, test_cutoff, num_prunes)
          if accuracy == max_accuracy:
              optimal_cutoffs.append(test_cutoff)
          elif accuracy > max_accuracy:
              optimal_cutoffs = [test_cutoff]
              max_accuracy = accuracy
  
      return single_cutoff(optimal_cutoffs)
function_tokens: def find_optimal_cutoff ( y , y_pred , num_prunes ) : max_accuracy = 0 optimal_cutoffs = [ ] possibles = possible_cutoffs ( y_pred ) for test_cutoff in possibles : accuracy , _ , _ = accuracy_per_tag ( y , y_pred , test_cutoff , num_prunes ) if accuracy == max_accuracy : optimal_cutoffs . append ( test_cutoff ) elif accuracy > max_accuracy : optimal_cutoffs = [ test_cutoff ] max_accuracy = accuracy return single_cutoff ( optimal_cutoffs )