Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predict_new() Forces Target Variable To Be Present In The New Data #128

Open
drag05 opened this issue Nov 21, 2024 · 0 comments
Open

predict_new() Forces Target Variable To Be Present In The New Data #128

drag05 opened this issue Nov 21, 2024 · 0 comments

Comments

@drag05
Copy link

drag05 commented Nov 21, 2024

Running the example under predict_new() documentation with the "Price" target variable removed from new data throws this error:

> out    <- train(lisbon_train, 'Price', verbose = FALSE, bayes_iter = 0, random_evals = 1)

# here, lisbon_new does not have the "Price":

> preds  <- predict_new(out, lisbon_new)

Error in `[.data.frame`(xgboost_data, , y) : undefined columns selected

> traceback()

5: stop("undefined columns selected")
4: `[.data.frame`(xgboost_data, , y)
3: xgboost_data[, y]
2: prepare_data(data, type = type, y = y, engine = engine, predict = TRUE, 
       train = train_data)
1: predict_new(out, lisbon_new)

prepare_data() seems to be y-aware and does not work without the target variable. However, having the target values present in the new data renders prediction unnecessary.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant