Skip to content

Instantly share code, notes, and snippets.

@GDBSD
Created June 11, 2022 18:21
Show Gist options
  • Select an option

  • Save GDBSD/e4e9e921fbfce51a149e1fa9ec12fd28 to your computer and use it in GitHub Desktop.

Select an option

Save GDBSD/e4e9e921fbfce51a149e1fa9ec12fd28 to your computer and use it in GitHub Desktop.
Calculate F-Beta
def calc_beta_f1(beta, precision, recall):
"""Calculate F-beta given the values for precision and recall and the beta value"""
beta_sq = pow(beta, 2)
num = (1 + beta_sq)*precision*recall
denom = beta_sq*precision+recall
return num/denom
@GDBSD

GDBSD commented Jun 11, 2022

Copy link
Copy Markdown
Author

Useful if you're asked to calculate F Beta given only the precision and recall values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment