Closed yzm886216 closed 3 days ago
The counterfactuals package needs a model that outputs probabilities. Although you set the classif.ranger
's predict.type
to prob
, you are using the po("threshold")
PipeOp. The latter turns probability predictions into response predictions by thresholding them.
What is the reason why you are using thresholding? If you are using the counterfactuals
package and want to limit yourself to counterfactuals that are beyond a certain probability, you probably need to use the desired_prob
argument of the $find_counterfactuals()
method.
And please don't cross-post on stackoverflow and here.
Closing this in favour of https://github.com/mlr-org/mlr3pipelines/issues/645
My code is showed below:
prc_rf_lrn=lrn("classif.ranger",predict_type="prob",importance="impurity") graph_rf=prc_rf_lrn %>>% po("threshold") graph_rf$plot() learners_rf=GraphLearner$new(graph_rf)
learners_rf 's predict_type is [response], prob