This function takes a linear discriminant model fit using lda and returns a list-of-lists representing in valid PFA document that could be used for scoring
# S3 method for lda
pfa(object, name = NULL, version = NULL, doc = NULL,
metadata = NULL, randseed = NULL, options = NULL,
prior = object$prior, dimen = length(object$svd), method = c("plug-in"),
pred_type = c("response", "prob"), cutoffs = NULL, ...)an object of class "lda"
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 named vector specifying the prior probabilities of class membership. If unspecified, the class proportions for the training set are used.
an integer specifying the dimension of the space to be used. If this is less than min(p input variables, number of classes - 1) then the first N number of dimensions will be used in the calculation
a character string indicating the prediction method. Currently, only the plug-in method is supported.
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
additional arguments affecting the PFA produced
a list of lists that compose valid PFA document
model <- MASS::lda(Species ~ ., data=iris)
model_as_pfa <- pfa(model)
Run the code above in your browser using DataLab