I wanted to create a pearson correlation coefficient metrics using tensorflow tensor. They do have a tensorflow probability package tfp.stats.correlation | TensorFlow Probability but this have dependency issues with the current version of tensorflow. I am afraid that this will cause the cuda to break. Any standalone implementation of pearson correlation coefficient metrics in tensorflow will help…
So I want something like this:
def p_corr(y_true, y_pred):
# calculate the pearson correlation coefficient here
return pearson_correlation_coefficient
Here y_true and y_pred will be a list of numbers of same dimension.