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, 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.
- 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.
transform
(dataset)Scale each non-zero row of the input dataset to the unit norm.