Last active
December 13, 2024 10:05
-
-
Save jrosell/667fee58c8ff47a99591fa6122e04ed3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Thanks to @koaning for pointing out this visualization in Stack Overflow https://stackoverflow.com/a/49535509/481463 in this video https://www.youtube.com/watch?v=3M2Gmuh5mtI | |
library(tidyverse) | |
library(rayshader) | |
library(viridis) | |
df <- | |
expand_grid( | |
precision = 1:100 / 100, | |
recall = 1:100 / 100, | |
) |> | |
mutate( | |
mean = (precision + recall) / 2, | |
f_1_score = 2*(precision * recall)/(precision + recall) | |
) |> | |
glimpse() | |
gg_mean <- df |> | |
ggplot() + | |
geom_tile(aes(x = precision, y = recall, fill = mean)) + | |
geom_contour(aes(x = precision, y = recall, z = mean)) + | |
scale_fill_viridis_c(option = "A") | |
gg_mean | |
plot_gg( | |
gg_mean, | |
multicore = TRUE, width=5, height=5, scale=250, windowsize=c(1400,866), | |
zoom = 0.55, phi = 30 | |
) | |
render_snapshot() | |
gg_f_1_score <- df |> | |
ggplot() + | |
geom_tile(aes(x = precision, y = recall, fill = f_1_score)) + | |
geom_contour(aes(x = precision, y = recall, z = f_1_score)) + | |
# geom_contour(apes(fill = f_1_score)) + | |
scale_fill_viridis_c(option = "A") | |
gg_f_1_score | |
plot_gg( | |
gg_f_1_score, | |
multicore = TRUE, width=5, height=5, scale=250, windowsize=c(1400,866), | |
zoom = 0.55, phi = 30 | |
) | |
render_snapshot() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mean

F1 score
