Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the points for the "basic" plots #16

Open
suzannejin opened this issue Apr 16, 2021 · 1 comment
Open

Limit the points for the "basic" plots #16

suzannejin opened this issue Apr 16, 2021 · 1 comment
Assignees

Comments

@suzannejin
Copy link

suzannejin commented Apr 16, 2021

Hi! Is there a way to limit the points to plot in "basic" mode?? Otherwise, it takes too much time in order to compute the plots...

@suzannejin suzannejin changed the title How is the pAUC calculated? Limit the points for the "basic" plots Apr 16, 2021
@takayasaito takayasaito self-assigned this Apr 19, 2021
@takayasaito
Copy link
Member

Precrec does not provide a method for controlling supporting points when the mode is set to basic. Nonetheless, there are several ways to reduce the computational time of generating plots.

  1. Use R's default plot function
  2. Specify type = "l" to change points to lines
  3. Specify metrics

Metrics can be one or a combination of error, accuracy, specificity, sensitivity, precision, mcc and fscore.

library(precrec)
library(ggplot2)

# Generate a dataset with 5 different models (P:1000, N:1000)
samp <- create_sim_samples(1, 1000, 1000)
mdat <- mmdata(samp[["scores"]], samp[["labels"]], modnames = samp[["modnames"]])
mdat

# Calculate basic metrics
sspoints <- evalmod(mdat, mode = "basic")

# 1. R's default plot
plot(sspoints)

# 2a. type = "l" 
plot(sspoints, type="l")

# 2b. type = "l" with ggplot
autoplot(sspoints, type="l")

# 3a. Specify metrics
autoplot(sspoints, type="l", "accuracy")
autoplot(sspoints, type="l", c("error", "accuracy"))

# 3a. Specify metrics with ggplot
autoplot(sspoints, type="l", "accuracy")
autoplot(sspoints, type="l", c("error", "accuracy"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants