Hello,
I have a net that runs on tensor data sets.
e.g. dls = DataLoaders.from_dsets(train_dl,valid_dl,bs=batch,shuffle=False)
it works fine.
I added the two functions below to the matrix.py because I want to moniter the “best” function that is a ratio of pearson/mae.
However, for small batches (less then 20) the pearson2 does not work and gives a wrong CorrCoef value.
I tried using the PearsonCorrCoef() but it does not work in a call back and I did not mange to add it to the “best” function. i I think it is got to do with the fact that PearsonCorrCoef() is a cumulative matrix?
Does any one have an idea how I can do it?
def pearson2(inp,targ):
inp, targ = flatten_check(inp, targ)
y = scs.pearsonr(inp, targ).statistic
return y
def best(inp,targ):
inp,targ = flatten_check(inp,targ)
mae = torch.abs(inp - targ).mean()
y = scs.pearsonr(inp,targ).statistic
value = y/mae
return value