Skip to content

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

@drag05

Description

@drag05

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions