tests/testthat/test_mlr_graphs_ovr.R

context("ppl - pipeline_ovr")

test_that("OVR Pipeline", {
  task = tsk("wine")

  # assertions on graph
  expect_error(ppl("ovr", lrn("regr.rpart")), regexp = "Output type of PipeOp ovrsplit during training.*TaskClassif.*incompatible")

  g = ppl("ovr", lrn("classif.rpart"))
  expect_graph(g)
  expect_true(length(g$pipeops) == 1 + 1 + 1)

  train_out = g$train(task)
  expect_null(train_out[[1]])

  predict_out = g$predict(task)
  expect_r6(predict_out[[1]], "PredictionClassif")
})

Try the mlr3pipelines package in your browser

Any scripts or data that you put into this service are public.

mlr3pipelines documentation built on May 31, 2023, 9:26 p.m.