1
$\begingroup$

Implementing the binary outcome (0 or 1) toy example from the Super Learner documentation produces a vector of values between 0 and 1 for the SL.predict object. My understanding is that in order to produce binary predictions, the user needs to reclassify these values to either 0 or 1. For example, if the model produced a prediction greater than 0.5, reclassify as 1. Otherwise, reclassify as 0.

Is my understanding correct? If not, some advice on how to interpret these results would be greatly appreciated.

Following is the code for the toy example and the resulting SL.predict object:

###Toy example
# binary outcome
set.seed(1)
N <- 200
X <- matrix(rnorm(N*10), N, 10)
X <- as.data.frame(X)
Y <- rbinom(N, 1, plogis(.2*X[, 1] + .1*X[, 2] - .2*X[, 3] +
                           .1*X[, 3]*X[, 4] - .2*abs(X[, 4])))
SL.library <- c("SL.glmnet", "SL.glm", "SL.knn", "SL.gam", "SL.mean")
# least squares loss function
test.NNLS <- SuperLearner(Y = Y, X = X, SL.library = SL.library,
                          verbose = TRUE, method = "method.NNLS", family = binomial())

# check some prediction values
head(test.NNLS$SL.predict)
       [,1]
1 0.3391220
2 0.3573499
3 0.4086673
4 0.4206464
5 0.4609441
6 0.3731298
>
$\endgroup$

1 Answer 1

1
$\begingroup$

SL's predicted values are the estimated conditional mean outcomes, i.e., the probability that Y_i = 1 given observed values for the vector X_i, P(Y = 1 | X). Yes, you may assign a classification of 1 if this probability is above some threshold value, c, and 0 if it is below. And yes you may decide to set c = 0.5. But it is also possible to pick any other value for c. This will trade-off sensitivity and specificity of your classifier. See wiki for more on this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.