def make_scorer(score_func, greater_is_better=True, needs_proba=False, needs_threshold=False, **kwargs):
 sign = (1 if greater_is_better else (-1))
 if (needs_proba and needs_threshold):
  raise ValueError('Set either needs_proba or needs_threshold to True, but not both.')
 if needs_proba:
  cls = _ProbaScorer
 elif needs_threshold:
  cls = _ThresholdScorer
 else:
  cls = _PredictScorer
 return cls(score_func, sign, kwargs)

def make_scorer ( score_func , greater_is_better = True , needs_proba = False , needs_threshold = False , ** kwargs ) : sign = ( 1 if greater_is_better else ( - 1 ) ) if ( needs_proba and needs_threshold ) : raise ValueError ( 'Set either needs_proba or needs_threshold to True, but not both.' ) if needs_proba : cls = _ProbaScorer elif needs_threshold : cls = _ThresholdScorer else : cls = _PredictScorer return cls ( score_func , sign , kwargs )
make a scorer from a performance metric or loss function .