I want to implement a custom metric (pearson correlation) as defined here in Keras. I get a batch (32) of predictions and labels. I use a neural network to predict 10 values. So my input is 32x10 predictions and 32x10 labels.
I would like to know how I get a single correlation value for batches of predictions/labels. Should I calculate the correlation for each prediction/label sample in the batch individually and then take the mean over the 32 samples or should I treat the batch as a "population" and use the covariance between prediction and label and divide it by the standard deviations?