2 Replies - 1800 Views - Last Post: 27 May 2020 - 01:39 AM Rate Topic: -----

#1 O'Niel   User is offline

  • D.I.C Addict

Reputation: 26
  • View blog
  • Posts: 598
  • Joined: 13-September 15

Calculating F-measure for 1.5 in data science

Posted 21 May 2020 - 03:47 PM

I have the following R script:
#amount of true positive, true negatives, false positives, and false negatives
tp <- 100
tn <- 50
fp <- 10
fn <- 5

tot <- tp + tn + fp + fn

#accuracy = aantal juiste / aantal voorspellingen
accuracy <- (tn + tp) / tot

#precision = tp / (tp + fp)
precision <- tp / (tp + fp)

#recall = tp / (tp + fn)
recall <- tp / (tp + fn)

#F-measure formula in course
a <- 1.5
#B <- (1-a) / a
FB <- ((B^2 + 1) * precision * recall) / ((B^2 * precision) + recall)

#True positive rate = TP / (TP + FN)
tpr = tp / (tp + fn)

#False positive rate = FP / (FP + TN)
fpr = fp / (fp + tn)

#F-measure formula from the internet
((2 * precision * recall) / (precision + recall))




In my exercises for data science I need to calculate the F1 measure, and the F1.5 measure. The formula from the cursus is not working. The formula on the bottom gives me the correct result for F1, but how do I change it so it also gives the correct result for F1.5 measure?

Is This A Good Question/Topic? 0
  • +

Replies To: Calculating F-measure for 1.5 in data science

#2 Ornstein   User is offline

  • D.I.C Head

Reputation: 105
  • View blog
  • Posts: 216
  • Joined: 13-May 15

Re: Calculating F-measure for 1.5 in data science

Posted 22 May 2020 - 02:54 AM

In your original code, it looks like you tried to do this:

B <- (1-a) / a


Do you need to do that? Couldn't you just do:

B <- 1.5
FB <- ((B^2 + 1) * precision * recall) / ((B^2 * precision) + recall)

Was This Post Helpful? 1
  • +
  • -

#3 O'Niel   User is offline

  • D.I.C Addict

Reputation: 26
  • View blog
  • Posts: 598
  • Joined: 13-September 15

Re: Calculating F-measure for 1.5 in data science

Posted 27 May 2020 - 01:39 AM

That seems to work! Thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1