nodes: 0, module; 1, function_definition; 2, function_name:compute_performance; 3, parameters; 4, block; 5, identifier:SC; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, expression_statement; 20, expression_statement; 21, if_statement; 22, if_statement; 23, identifier:verbose; 24, True; 25, identifier:output; 26, string; 27, comment:"""
      Return some performance value for comparison.
  
      Parameters
      -------
      SC: SortingComparison instance
          The SortingComparison
  
      verbose: bool
          Display on console or not
  
      output: dict or pandas
  
  
      Returns
      ----------
  
      performance: dict or pandas.Serie depending output param
  
      """; 28, assignment; 29, assignment; 30, assignment; 31, assignment; 32, assignment; 33, assignment; 34, assignment; 35, assignment; 36, assignment; 37, assignment; 38, assignment; 39, assignment; 40, identifier:verbose; 41, block; 42, comparison_operator:output == 'dict'; 43, block; 44, elif_clause; 45, string_content:dict; 46, identifier:counts; 47, attribute; 48, identifier:tp_rate; 49, binary_operator:float(counts['TP']) / counts['TOT_ST1'] * 100; 50, identifier:cl_rate; 51, binary_operator:float(counts['CL']) / counts['TOT_ST1'] * 100; 52, identifier:fn_rate; 53, binary_operator:float(counts['FN']) / counts['TOT_ST1'] * 100; 54, identifier:fp_st1; 55, binary_operator:float(counts['FP']) / counts['TOT_ST1'] * 100; 56, identifier:fp_st2; 57, binary_operator:float(counts['FP']) / counts['TOT_ST2'] * 100; 58, identifier:accuracy; 59, binary_operator:tp_rate / (tp_rate + fn_rate + fp_st1) * 100; 60, identifier:sensitivity; 61, binary_operator:tp_rate / (tp_rate + fn_rate) * 100; 62, identifier:miss_rate; 63, binary_operator:fn_rate / (tp_rate + fn_rate) * 100; 64, identifier:precision; 65, binary_operator:tp_rate / (tp_rate + fp_st1) * 100; 66, identifier:false_discovery_rate; 67, binary_operator:fp_st1 / (tp_rate + fp_st1) * 100; 68, identifier:performance; 69, dictionary; 70, expression_statement; 71, expression_statement; 72, identifier:output; 73, string; 74, return_statement; 75, comparison_operator:output == 'pandas'; 76, block; 77, identifier:SC; 78, identifier:_counts; 79, binary_operator:float(counts['TP']) / counts['TOT_ST1']; 80, integer:100; 81, binary_operator:float(counts['CL']) / counts['TOT_ST1']; 82, integer:100; 83, binary_operator:float(counts['FN']) / counts['TOT_ST1']; 84, integer:100; 85, binary_operator:float(counts['FP']) / counts['TOT_ST1']; 86, integer:100; 87, binary_operator:float(counts['FP']) / counts['TOT_ST2']; 88, integer:100; 89, binary_operator:tp_rate / (tp_rate + fn_rate + fp_st1); 90, integer:100; 91, binary_operator:tp_rate / (tp_rate + fn_rate); 92, integer:100; 93, binary_operator:fn_rate / (tp_rate + fn_rate); 94, integer:100; 95, binary_operator:tp_rate / (tp_rate + fp_st1); 96, integer:100; 97, binary_operator:fp_st1 / (tp_rate + fp_st1); 98, integer:100; 99, pair; 100, pair; 101, pair; 102, pair; 103, pair; 104, pair; 105, pair; 106, pair; 107, pair; 108, pair; 109, assignment; 110, call; 111, string_content:dict; 112, identifier:performance; 113, identifier:output; 114, string; 115, return_statement; 116, call; 117, subscript; 118, call; 119, subscript; 120, call; 121, subscript; 122, call; 123, subscript; 124, call; 125, subscript; 126, identifier:tp_rate; 127, parenthesized_expression; 128, identifier:tp_rate; 129, parenthesized_expression; 130, identifier:fn_rate; 131, parenthesized_expression; 132, identifier:tp_rate; 133, parenthesized_expression; 134, identifier:fp_st1; 135, parenthesized_expression; 136, string; 137, identifier:tp_rate; 138, string; 139, identifier:cl_rate; 140, string; 141, identifier:fn_rate; 142, string; 143, identifier:fp_st1; 144, string; 145, identifier:fp_st2; 146, string; 147, identifier:accuracy; 148, string; 149, identifier:sensitivity; 150, string; 151, identifier:precision; 152, string; 153, identifier:miss_rate; 154, string; 155, identifier:false_discovery_rate; 156, identifier:txt; 157, call; 158, identifier:print; 159, argument_list; 160, string_content:pandas; 161, call; 162, identifier:float; 163, argument_list; 164, identifier:counts; 165, string; 166, identifier:float; 167, argument_list; 168, identifier:counts; 169, string; 170, identifier:float; 171, argument_list; 172, identifier:counts; 173, string; 174, identifier:float; 175, argument_list; 176, identifier:counts; 177, string; 178, identifier:float; 179, argument_list; 180, identifier:counts; 181, string; 182, binary_operator:tp_rate + fn_rate + fp_st1; 183, binary_operator:tp_rate + fn_rate; 184, binary_operator:tp_rate + fn_rate; 185, binary_operator:tp_rate + fp_st1; 186, binary_operator:tp_rate + fp_st1; 187, string_content:tp; 188, string_content:cl; 189, string_content:fn; 190, string_content:fp_st1; 191, string_content:fp_st2; 192, string_content:accuracy; 193, string_content:sensitivity; 194, string_content:precision; 195, string_content:miss_rate; 196, string_content:false_disc_rate; 197, attribute; 198, argument_list; 199, identifier:txt; 200, attribute; 201, argument_list; 202, subscript; 203, string_content:TOT_ST1; 204, subscript; 205, string_content:TOT_ST1; 206, subscript; 207, string_content:TOT_ST1; 208, subscript; 209, string_content:TOT_ST1; 210, subscript; 211, string_content:TOT_ST2; 212, binary_operator:tp_rate + fn_rate; 213, identifier:fp_st1; 214, identifier:tp_rate; 215, identifier:fn_rate; 216, identifier:tp_rate; 217, identifier:fn_rate; 218, identifier:tp_rate; 219, identifier:fp_st1; 220, identifier:tp_rate; 221, identifier:fp_st1; 222, identifier:_txt_performance; 223, identifier:format; 224, dictionary_splat; 225, identifier:pd; 226, identifier:Series; 227, identifier:performance; 228, identifier:counts; 229, string; 230, identifier:counts; 231, string; 232, identifier:counts; 233, string; 234, identifier:counts; 235, string; 236, identifier:counts; 237, string; 238, identifier:tp_rate; 239, identifier:fn_rate; 240, identifier:performance; 241, string_content:TP; 242, string_content:CL; 243, string_content:FN; 244, string_content:FP; 245, string_content:FP
code: def compute_performance(SC, verbose=True, output='dict'):
      """
      Return some performance value for comparison.
  
      Parameters
      -------
      SC: SortingComparison instance
          The SortingComparison
  
      verbose: bool
          Display on console or not
  
      output: dict or pandas
  
  
      Returns
      ----------
  
      performance: dict or pandas.Serie depending output param
  
      """
      counts = SC._counts
  
      tp_rate = float(counts['TP']) / counts['TOT_ST1'] * 100
      cl_rate = float(counts['CL']) / counts['TOT_ST1'] * 100
      fn_rate = float(counts['FN']) / counts['TOT_ST1'] * 100
      fp_st1 = float(counts['FP']) / counts['TOT_ST1'] * 100
      fp_st2 = float(counts['FP']) / counts['TOT_ST2'] * 100
  
      accuracy = tp_rate / (tp_rate + fn_rate + fp_st1) * 100
      sensitivity = tp_rate / (tp_rate + fn_rate) * 100
      miss_rate = fn_rate / (tp_rate + fn_rate) * 100
      precision = tp_rate / (tp_rate + fp_st1) * 100
      false_discovery_rate = fp_st1 / (tp_rate + fp_st1) * 100
  
      performance = {'tp': tp_rate, 'cl': cl_rate, 'fn': fn_rate, 'fp_st1': fp_st1, 'fp_st2': fp_st2,
                     'accuracy': accuracy, 'sensitivity': sensitivity, 'precision': precision, 'miss_rate': miss_rate,
                     'false_disc_rate': false_discovery_rate}
  
      if verbose:
          txt = _txt_performance.format(**performance)
          print(txt)
  
      if output == 'dict':
          return performance
      elif output == 'pandas':
          return pd.Series(performance)