# Calculating F-measure for 1.5 in data science

Page 1 of 1

## 2 Replies - 1796 Views - Last Post: 27 May 2020 - 01:39 AMRate Topic:     //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=419313&amp;s=25b443aa6b5fe7e8b9eaf92ae2480900&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 O'Niel Reputation: 26
• 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 Reputation: 105
• 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)
```

### #3 O'Niel Reputation: 26
• 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.

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }