I would like ask your opinions on naming before make a pr.
 Because scipy.stats.spearmanr or pearsonr return
(correlation, p_value)
, I needAccumMetric
to be able to catch only first element of the return.
class MyAccumMetric(AccumMetric):
def __init__(self, func, get=None, **kwargs):
super().__init__(func, **kwargs)
self.get = None if get is None else partial(get_item, i=get)
@property
def value(self):
....
out = self.func(targs, preds, **self.kwargs) if self.invert_args else self.func(preds, targs, **self.kwargs)
return self.get(out) if self.get else out
Is there better naming or way to do this ?

change
skm_to_fastai
toscim_to_fastai
, because we will also use scipy, and add importfrom scipy import stats as spm

Because we need to pass
axis
toscipy.stats. spearmanr
viascim_to_fastai
(skm_to_fastai
), so original argumentaxis
ofscim_to_fastai
should rename to other name such asdim_argmax
. (And if adopt this change, we will also need to change other metric specifyaxis
in the use ofskm_to_fastai
) 
add
MatthewsCorrCoef
which instead ofthresh
andsigmoid
, passdim_argmax
Three metrics would be like this.
def MatthewsCorrCoef(dim_argmax=1, sample_weight=None):
"Matthews correlation coefficient for singlelabel classification problems"
return scim_to_fastai(skm.matthews_corrcoef, invert_args=True, dim_argmax=dim_argmax, flatten=True, sample_weight=sample_weight)
def PearsonCorrCoef(dim_argmax=1):
"Pearson correlation coefficient for singlelabel classification problems"
return scim_to_fastai(spm.pearsonr, invert_args=False, get=0, dim_argmax=dim_argmax, flatten=True,)
def SpearmanCorrCoef(dim_argmax=1, axis=0, nan_policy='propagate'):
"Spearman correlation coefficient for singlelabel classification problems"
return scim_to_fastai(spm.spearmanr, invert_args=False, get=0, dim_argmax=dim_argmax, flatten=True, axis=axis, nan_policy=nan_policy)