snowflake.ml.modeling.preprocessing.Normalizer

class snowflake.ml.modeling.preprocessing.Normalizer(*, norm: str = 'l2', input_cols: Optional[Union[str, Iterable[str]]] = None, output_cols: Optional[Union[str, Iterable[str]]] = None, passthrough_cols: Optional[Union[str, Iterable[str]]] = None, drop_input_cols: Optional[bool] = False)

Bases: BaseTransformer

Normalize samples individually to each row’s unit norm.

Each sample (i.e. each row of the data matrix) with at least one non-zero component is rescaled independently of other samples so that its norm (l1, l2 or inf) equals one.

Args:
norm: str, default=”l2”

The norm to use to normalize each non-zero sample. If norm=’max’ is used, values will be rescaled by the maximum of the absolute values. It must be one of ‘l1’, ‘l2’, or ‘max’.

input_cols: Optional[Union[str, List[str]]]

Columns to use as inputs during transform.

output_cols: Optional[Union[str, List[str]]]

A string or list of strings representing column names that will store the output of transform operation. The length of output_cols must equal the length of input_cols.

passthrough_cols: Optional[Union[str, List[str]]]

A string or a list of strings indicating column names to be excluded from any operations (such as train, transform, or inference). These specified column(s) will remain untouched throughout the process. This option is helpful in scenarios requiring automatic input_cols inference, but need to avoid using specific columns, like index columns, during training or inference.

drop_input_cols: bool, default=False

Remove input columns from output if set True.

Methods

fit(dataset)

Does nothing, because the normalizer is a stateless transformer.

get_input_cols()

Input columns getter.

get_label_cols()

Label column getter.

get_output_cols()

Output columns getter.

get_params([deep])

Get parameters for this transformer.

get_passthrough_cols()

Passthrough columns getter.

get_sample_weight_col()

Sample weight column getter.

get_sklearn_args([default_sklearn_obj, ...])

Get sklearn keyword arguments.

set_drop_input_cols([drop_input_cols])

set_input_cols(input_cols)

Input columns setter.

set_label_cols(label_cols)

Label column setter.

set_output_cols(output_cols)

Output columns setter.

set_params(**params)

Set the parameters of this transformer.

set_passthrough_cols(passthrough_cols)

Passthrough columns setter.

set_sample_weight_col(sample_weight_col)

Sample weight column setter.

to_lightgbm()

to_sklearn()

to_xgboost()

transform(dataset)

Scale each non-zero row of the input dataset to the unit norm.