Preprocessing powertransformeroptions - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Preprocessing is 0.2.0 — read its documentation.

Home › Preprocessing › Feature transforming

PowerTransformerOptions

Which power family PowerTransformer fits, and whether it standardises after.

public sealed record PowerTransformerOptions

Properties — Method is which family; scikit-learn's method, default PowerMethod.YeoJohnson. Standardize centres and scales the transformed column; standardize, default true.

Example — turning the standardisation off leaves the raw power.

using Lodestar.Preprocessing;

double[] income = [22.0, 25.0, 28.0, 31.0, 35.0, 42.0, 55.0, 78.0, 120.0, 260.0];

var options = new PowerTransformerOptions { Standardize = false };

PowerTransformer raw = PowerTransformer.Fit(income, 1, options);

double[] ends = raw.Transform([22.0, 260.0]);

double smallest = Math.Round(ends[0], 4);   // => 1.1403
double largest = Math.Round(ends[1], 4);    // => 1.225

Remarks — Standardize changes the output, never the exponent. The likelihood is maximised on the powered column before anything is centred, so both settings fit the same Lambdas; the switch decides only whether a StandardScaler, the reference's own, is fitted afterwards, taking off each powered column's mean and dividing by its deviation — on a constant Yeo-Johnson feature the raw column's, which the reference leaves untransformed at fit (#1230).

Leave it on unless something downstream needs the raw scale. The powered values above span 1.14 to 1.23, a range that will disappear beside any unscaled neighbour in the same matrix — which is the reason the reference defaults it on.

copy is absent, as everywhere in this package.

Being a record, two option sets with the same two values are equal.

Applies to — net10.0, netstandard2.0.

See also — PowerTransformer.Fit, PowerMethod.