Built-in Transformers

Built-in Transformers

UnivariateStandardizer()

Unsupervised model for standardizing (whitening) univariate data.

Standardizer(; features=Symbol[])

Unsupervised model for standardizing (whitening) the columns of tabular data. If features is empty then all columns v for which all elements have Continuous scitypes are standardized. For different behaviour, specify the names of features to be standardized.

using DataFrames
X = DataFrame(x1=[0.2, 0.3, 1.0], x2=[4, 2, 3])
stand_model = Standardizer()
transform(fit!(machine(stand_model, X)), X)

3×2 DataFrame
│ Row │ x1        │ x2    │
│     │ Float64   │ Int64 │
├─────┼───────────┼───────┤
│ 1   │ -0.688247 │ 4     │
│ 2   │ -0.458831 │ 2     │
│ 3   │ 1.14708   │ 3     │
OneHotEncoder(; features=Symbol[], drop_last=false, ordered_factor=true)

Unsupervised model for one-hot encoding all features of Finite scitype, within some table. If ordered_factor=false then only Multiclass features are considered. The features encoded is further restricted to those in features, when specified and non-empty.

If drop_last is true, the column for the last level of each categorical feature is dropped. New data to be transformed may lack features present in the fit data, but no new features can be present.

Warning: This transformer assumes that the elements of a categorical feature in new data to be transformed point to the same CategoricalPool object encountered during the fit.

FeatureSelector(features=Symbol[])

An unsupervised model for filtering features (columns) of a table. Only those features encountered during fitting will appear in transformed tables if features is empty (the default). Alternatively, if a non-empty features is specified, then only the specified features are used. Throws an error if a recorded or specified feature is not present in the transformation input.

UnivariateBoxCoxTransformer(; n=171, shift=false)

Unsupervised model specifying a univariate Box-Cox transformation of a single variable taking non-negative values, with a possible preliminary shift. Such a transformation is of the form

x -> ((x + c)^λ - 1)/λ for λ not 0
x -> log(x + c) for λ = 0

On fitting to data n different values of the Box-Cox exponent λ (between -0.4 and 3) are searched to fix the value maximizing normality. If shift=true and zero values are encountered in the data then the transformation sought includes a preliminary positive shift c of 0.2 times the data mean. If there are no zero values, then no shift is applied.