if (requireNamespace('data.table', quietly = TRUE)) {
# don't multi-thread during CRAN checks
data.table::setDTthreads(1)
}
df <- iris
df$isVersicolor <- with(df, Species=='versicolor')
model = glm(isVersicolor ~ Petal.Length + Petal.Width + Sepal.Length + Sepal.Width,
data=df, family=binomial)
df$pred = predict(model, newdata=df, type="response")
WVPlots::PRTPlot(df, "pred", "isVersicolor", TRUE, title="Example Precision-Recall threshold plot")
if (FALSE) {
WVPlots::PRTPlot(df, "pred", "isVersicolor", TRUE,
plotvars = c("sensitivity", "specificity", "false_positive_rate"),
title="Sensitivity/specificity/FPR as functions of threshold")
}
Run the code above in your browser using DataLab