tests/testthat/test_pmml.gbm.R

data(audit)


test_that("pmml.gbm final Segment contains modelName attribute", {
  skip_if_not_installed("gbm")
  library(gbm)

  audit_dat <- audit[, -c(1, 4, 6, 9, 10, 11, 12)]
  fit <- gbm(Adjusted ~ ., data = audit_dat, n.trees = 3, interaction.depth = 4, distribution = "multinomial")
  p_fit <- pmml(fit)

  expect_equal(xmlGetAttr(p_fit[[3]][[3]][[7]][[2]], name = "modelName"), "GBM_Model")
  expect_equal(xmlGetAttr(p_fit[[3]][[3]][[7]][[2]], name = "normalizationMethod"), "softmax")
})

Try the pmml package in your browser

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

pmml documentation built on March 18, 2022, 5:49 p.m.