Created
May 20, 2021 03:37
-
-
Save bhavsarpratik/1abbfdb7686be4270970066ac175f7e3 to your computer and use it in GitHub Desktop.
fbeta_harmonic_mean.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fbeta_harmonic_mean(metric1: float, metric2: float, beta: float): | |
""" Return harmonic mean giving more importance to one metric | |
metric1: metric1 value | |
metric2: metric2 value | |
beta : The strength of metric2 versus metric1 in the F-score. | |
""" | |
beta2 = beta ** 2 | |
denom = beta2 * metric1 + metric2 | |
f_score = (1 + beta2) * metric1 * metric2 / denom | |
return f_score |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment