Closed verajosemanuel closed 3 years ago
Hi. logLoss is defined only for predictions > 0 and < 1. In your case, they are all 0 or 1. Can you try to remove this metric and see if the code works?
Same error, sorry. In fact, I get a probability of conversion instead a class.
Solved tweaking the predict function to return 1/0 given a probability threshold
my_predict = function (model,data) {
preds <- predict(model,data, type = "prob")
preds %<>% dplyr::mutate(.pred_conversion = if_else(.pred_conversion > 0.70, 1, 0))
return(preds$.pred_conversion)
}
Sweet! But then, the first approach might have failed because recall
is only defined for predictions in {0, 1}. Normally it is better to work with probabilities, so you can try out the original approach with the "right" metrics (e.g. logloss and AUC).
Created a working model with xgboost tidymodels workflow. Checked if the model predicts accordingly. All seems ok. We get probability of conversion for a bunch of customer visitors to our page. All target factors are present and mutated to TRUE/FALSE
We get an error when plotting performance
We reproduced the error with vignette example just setting iris (ir) virginica column to virginica/notvirginica
Thanks