pfa.gbm {aurelius}R Documentation

PFA Formatting of Fitted GBMs


This function takes a gradient boosted machine (gbm) fit using gbm and returns a list-of-lists representing in valid PFA document that could be used for scoring


## S3 method for class 'gbm'
pfa(object, name = NULL, version = NULL, doc = NULL,
  metadata = NULL, randseed = NULL, options = NULL,
  pred_type = c("response", "prob"), cutoffs = NULL, n.trees = NULL, ...)



an object of class "gbm"


a character which is an optional name for the scoring engine


an integer which is sequential version number for the model


a character which is documentation string for archival purposes


a list of strings that is computer-readable documentation for archival purposes


a integer which is a global seed used to generate all random numbers. Multiple scoring engines derived from the same PFA file have different seeds generated from the global one


a list with value types depending on option name Initialization or runtime options to customize implementation (e.g. optimization switches). May be overridden or ignored by PFA consumer


a string with value "response" for returning a prediction on the same scale as what was provided during modeling, or value "prob", which for classification problems returns the probability of each class.


(Classification only) A named numeric vector of length equal to number of classes. The "winning" class for an observation is the one with the maximum ratio of predicted probability to its cutoff. The default cutoffs assume the same cutoff for each class that is 1/k where k is the number of classes


an integer or vector of integers specifying the number of trees to use in building the model. If a vector is provided, then only the indices of thos trees will be used. If a single integer is provided then all trees up until and including that index will be used.


additional arguments affecting the PFA produced


a list of lists that compose valid PFA document


pfa_config.R avro_typemap.R avro.R pfa_cellpool.R pfa_expr.R pfa_utils.R

See Also



dat <- data.frame(X1 = runif(100), 
                  X2 = rnorm(100))
dat$Y <- ((rexp(100,5) + 5 * dat$X1 - 4 * dat$X2) > 0)

bernoulli_model <- gbm::gbm(Y ~ X1 + X2, 
                            data = dat, 
                            distribution = 'bernoulli')
model_as_pfa <- pfa(bernoulli_model)

[Package aurelius version 0.8.4 Index]