pfa.cv.glmnet: PFA Formatting of Fitted glmnet objects

Description Usage Arguments Value Source See Also Examples

Description

This function takes a generalized linear model fit using cv.glmnet and returns a list-of-lists representing a valid PFA document that could be used for scoring

Usage

1
2
3
4
5
## S3 method for class 'cv.glmnet'
pfa(object, name = NULL, version = NULL, doc = NULL,
  metadata = NULL, randseed = NULL, options = NULL,
  lambda = object[["lambda.1se"]], pred_type = c("response", "prob"),
  cutoffs = NULL, ...)

Arguments

object

an object of class "cv.glmnet"

name

a character which is an optional name for the scoring engine

version

an integer which is sequential version number for the model

doc

a character which is documentation string for archival purposes

metadata

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

randseed

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

options

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

lambda

a numeric value of the penalty parameter lambda at which coefficients are required

pred_type

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.

cutoffs

(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

...

additional arguments affecting the PFA produced

Value

a list of lists that compose valid PFA document

Source

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

See Also

glmnet extract_params.glmnet

Examples

1
2
3
4
5
X <- matrix(c(rnorm(100), runif(100)), nrow=100, ncol=2)
Y <- factor(3 - 5 * X[,1] + 3 * X[,2] + rnorm(100, 0, 3) > 0)

model <- glmnet::cv.glmnet(X, Y, family = 'binomial')
model_as_pfa <- pfa(model)

aurelius documentation built on May 2, 2019, 3:43 a.m.