tests/testthat/test-caret-training.R

test_that("model training with caret works", {
  set.seed(432)

  library(caret)
  library(owl)

  xy <- owl:::randomProblem(1000, 2, q = 1)

  ctrl <- trainControl(method = "cv", number = 3)

  train <- train(xy$x,
                 xy$y,
                 method = caretSlopeOwl(),
                 preProc = c("center", "scale"),
                 tuneLength = 2,
                 trControl = ctrl)
  expect_s3_class(train, "train")
})

Try the owl package in your browser

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

owl documentation built on Feb. 11, 2020, 5:09 p.m.