weendeen
weendeen

Reputation: 1

Partykit predict function throws warning when predicting with new data

Im trying to predict new data with a ctree object. I get this warning message when I run the function:

b1b2_party <- ctree(factor(final_category_bin) ~ ., data = train, control = ctree_control(maxsurrogate = 3))

predict.party(b1b2_party, newdata = test, type = "response")

Warning message: In retid[indx] <- fitted_node(kids_node(node)[[i]], data, vmatch, : number of items to replace is not a multiple of replacement length

The result of predict.party is a vector of all 1s (my target variable is a factor with levels 0 and 1), which leads me to believe that this warning is really messing with the results.

The test data was handled the same way as the training data. I haven't found a way to create a reproducible example for this issue, and I apologize for that. But I am wondering if anyone else has encountered this warning and what their way forward was.

I tried to predict new data with a ctree object. I expected a mix of conclusions but got all 1s returned and a warning.

Upvotes: 0

Views: 35

Answers (0)

Related Questions