'Couldn't find a saved dataset
model_one <-glm(
Survived ~ age_imputed,
family = binomial(),
data = train_imputed
)
logistic_cv1 <- cv.glm(train_imputed, model_1, cost, K=5)
logistic_cv1$delta
I'm trying to use k-fold cross-validation to measure our model's performance on data. So I used glm function but after I run the code, this error message pops up,
Error in cv.glm(train_imputed, model_1, cost, K = 5) : object 'model_1' not found
How to fix this problem? I found it weird I saved model_1 as a new variable. But I couldn't find its dataset.
Solution 1:[1]
Very easy: your model in your code above is called model_one, but you call for model_1 in your code.
Run this and it should work:
logistic_cv1 <- cv.glm(train_imputed, model_one, cost, K=5)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Andy |
