threshOptim | R Documentation |
threshOptim will return the utility maximizing threshold for future predictions along with the data generated to estimate the threshold
threshOptim(
data,
actTar = "target",
predTar = "p1",
tpProfit = 0,
tnProfit = 0,
fpProfit = -1,
fnProfit = -2,
MinThresh = 0.001,
MaxThresh = 0.999,
ThresholdPrecision = 0.001
)
data |
data is the data table you are building the modeling on |
actTar |
The column name where the actual target variable is located (in binary form) |
predTar |
The column name where the predicted values are located |
tpProfit |
This is the utility for generating a true positive prediction |
tnProfit |
This is the utility for generating a true negative prediction |
fpProfit |
This is the cost of generating a false positive prediction |
fnProfit |
This is the cost of generating a false negative prediction |
MinThresh |
Minimum value to consider for model threshold |
MaxThresh |
Maximum value to consider for model threshold |
ThresholdPrecision |
Incrementing value in search |
Optimal threshold and corresponding utilities for the range of thresholds tested
Adrian Antico
Other Model Evaluation and Interpretation:
AutoShapeShap()
,
CumGainsChart()
,
EvalPlot()
,
ParDepCalPlots()
,
ROCPlot()
,
RedYellowGreen()
,
ResidualPlots()
,
SingleRowShapeShap()
## Not run:
data <- data.table::data.table(Target = runif(10))
data[, x1 := qnorm(Target)]
data[, x2 := runif(10)]
data[, Predict := log(pnorm(0.85 * x1 + sqrt(1-0.85^2) * qnorm(x2)))]
data[, ':=' (x1 = NULL, x2 = NULL)]
data <- threshOptim(data = data,
actTar = "Target",
predTar = "Predict",
tpProfit = 0,
tnProfit = 0,
fpProfit = -1,
fnProfit = -2,
MinThresh = 0.001,
MaxThresh = 0.999,
ThresholdPrecision = 0.001)
optimalThreshold <- data$Thresholds
allResults <- data$EvaluationTable
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.