make_fff: Make a functional-form-fisher

Description Usage Arguments Details Value

View source: R/functional-form-fisher.R

Description

This function takes a target-variable and its family, and creates a function that, when applied to a predictor-variable, produces a variety of functional-forms, or transformation, for that predictor. The intention for this function is that it's used in the 'formula' part of a call to a regularized model (like glmnet), which will then penalize useless transformations and choose the best. Importantly, this includes a 'makepredictcall' method, so that future predictions from models that use the functional-form-fisher won't recompute the transformation-configuration, but will instead recall the previous computations.

Usage

1
make_fff(dv, family, max_num_bins = 8, max_collinear = 0.98)

Arguments

dv

A target-variable. Used for binning.

family

The family of the target-variable, as would be passed to stats::glm.

max_num_bins

The maximum number of bins to be produced by binning.

max_collinear

The resulting tranfsormations plus the untransformed original are all passed to caret::findCorrelation, with a cutoff = max_collinear. This avoids adding transformations that don't do anything.

Details

Currently, this function only tries a few transformations: sqrt and log (if all x>=0), and binning. In the future, more transformations will be supported (sigmoid, hinge), as well as custom transformations.

Value

A function, which, when applied to a numeric variable, returns a matrix of class 'fff' with a makepredictcall method.


strongio/stronger documentation built on Sept. 15, 2017, 3:54 p.m.