@@ -98,3 +98,25 @@ test_that("PipeOpLearnerCV - model active binding to state", {
9898 expect_null(po $ learner $ state )
9999 expect_equal(po $ learner_model $ state , po $ state )
100100})
101+
102+ test_that(" predict_type" , {
103+ expect_equal(po(" learner_cv" , lrn(" classif.rpart" , predict_type = " response" ))$ predict_type , " response" )
104+ expect_equal(po(" learner_cv" , lrn(" classif.rpart" , predict_type = " prob" ))$ predict_type , " prob" )
105+
106+ lcv <- po(" learner_cv" , lrn(" classif.rpart" , predict_type = " prob" ))
107+
108+ lcv $ predict_type = " response"
109+ expect_equal(lcv $ predict_type , " response" )
110+ expect_equal(lcv $ learner $ predict_type , " response" )
111+
112+ expect_equal(lcv $ train(list (tsk(" iris" )))[[1 ]]$ feature_names , " classif.rpart.response" )
113+
114+ lcv $ predict_type = " prob"
115+
116+ expect_equal(lcv $ predict_type , " prob" )
117+ expect_equal(lcv $ learner $ predict_type , " prob" )
118+
119+ expect_subset(c(" classif.rpart.prob.virginica" , " classif.rpart.prob.setosa" , " classif.rpart.prob.versicolor" ),
120+ lcv $ train(list (tsk(" iris" )))[[1 ]]$ feature_names )
121+
122+ })
0 commit comments