Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Concordance Correlation Coefficient to metrics #1194

Closed
segalinc opened this issue Aug 25, 2022 · 2 comments · Fixed by #1201
Closed

Add Concordance Correlation Coefficient to metrics #1194

segalinc opened this issue Aug 25, 2022 · 2 comments · Fixed by #1201
Labels
enhancement New feature or request New metric
Milestone

Comments

@segalinc
Copy link

🚀 Feature

Add Concordance Correlation Coefficient to metrics

Motivation

a lot of regression algorithm use this metric

Pitch

add it to the set of metrics

Additional context

python code

def PCC(ground_truth, predictions):
    """
        Evaluates the Pearson Correlation Coefficient.
        Inputs are numpy arrays.
        Corr = Cov(GT, Est)/(std(GT)std(Est))
    """
    return np.corrcoef(ground_truth, predictions)[0, 1]

def CCC(ground_truth, predictions):
    """
        Evaluates the Concordance Correlation Coefficient.
        Inputs are numpy arrays.
    """
    mean_pred = np.mean(predictions)
    mean_gt = np.mean(ground_truth)

    std_pred = np.std(predictions)
    std_gt = np.std(ground_truth)

    pearson = PCC(ground_truth, predictions)
    return 2.0*pearson*std_pred*std_gt/(std_pred**2+std_gt**2+(mean_pred-mean_gt)**2)
@segalinc segalinc added the enhancement New feature or request label Aug 25, 2022
@github-actions
Copy link

Hi! thanks for your contribution!, great first issue!

@segalinc
Copy link
Author

Thank you !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request New metric
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants