Description Usage Arguments Value Examples
This function creates a weighted average of predictions from two models and evaluates F1, precision, recall, auc or c for each combination of the models to determine the best weights for each.
1 | optimizeModelWeight(pred1, pred2, actual, steps = 50, cutoff = 0.5)
|
pred1 |
numeric vector of probabilities, prediction from model 1 |
pred2 |
numeric vector of probabilities, prediction from model 2 |
actual |
vector of 1s and 0s. The target variable test data |
steps |
number, high numbers compute a more exhaustive combination of model weights |
cutoff |
Cutoff used to demarcate predictions into positive or negative class. |
ytest, |
vector of the target variable from test data. (0s and 1s) |
jitterPlot |
|
data.frame of results
1 2 3 4 5 | require('Hmisc')
fit_glm1 <- glm(am~cyl, data=mtcars, family=binomial(logit))
fit_glm2 <- glm(am~disp, data=mtcars, family=binomial(logit))
ow <- optimizeModelWeight(fit_glm1$fitted.values, fit_glm2$fitted.values, actual=fit_glm1$model$am)
plot(ow$weights, ow$precision, type='l', xlab='weight on model 1')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.