kdpsingh / runway

Visualizing Prediction Model Performance
Other
75 stars 11 forks source link

Issue with the threshperf_plot() #24

Open drjgauthier opened 1 year ago

drjgauthier commented 1 year ago

Hello friends, having some issue with the threshperf_plot(). See below reprex:

library(runway)
#> Warning: replacing previous import 'Hmisc::summarize' by 'dplyr::summarize' when
#> loading 'runway'
#> Warning: replacing previous import 'Hmisc::src' by 'dplyr::src' when loading
#> 'runway'
#> Warning: replacing previous import 'pROC::cov' by 'stats::cov' when loading
#> 'runway'
#> Warning: replacing previous import 'dplyr::filter' by 'stats::filter' when
#> loading 'runway'
#> Warning: replacing previous import 'dplyr::lag' by 'stats::lag' when loading
#> 'runway'
#> Warning: replacing previous import 'pROC::var' by 'stats::var' when loading
#> 'runway'
#> Warning: replacing previous import 'pROC::smooth' by 'stats::smooth' when
#> loading 'runway'
data(single_model_dataset)
threshperf_plot(single_model_dataset, outcome = 'outcomes', prediction = 'predictions')
#> Error:
#> ! Can't subset `.data` outside of a data mask context.
#> Backtrace:
#>     ▆
#>  1. ├─runway::threshperf_plot(...)
#>  2. │ └─runway::threshperf(df, outcome, prediction, thresholds)
#>  3. │   └─... %>% filter(.data$.metric %in% .env$statistics)
#>  4. ├─stats::filter(., .data$.metric %in% .env$statistics)
#>  5. ├─.data$.metric %in% .env$statistics
#>  6. ├─.metric
#>  7. └─rlang:::`$.rlang_fake_data_pronoun`(.data, .metric)
#>  8.   └─rlang:::stop_fake_data_subset(call)
#>  9.     └─rlang::abort(...)

Created on 2023-07-18 with reprex v2.0.2

Do I need to update my R? Using R 4.2.2 Thank you!

Jordan

kdpsingh commented 1 year ago

@aarjun94 can you help look into this?

aarjun94 commented 1 year ago

Hello @drjgauthier,

The issue should be resolved. Let us know if it still persists.

kdpsingh commented 1 year ago

One thing to be aware of in threshperf_plot() is that the labels may be inverted due to a quirk in how the “positive” level is determined. This will be fixed in a separate issue.