You are viewing documentation about an older version (1.0.9). View latest version

snowflake.ml.modeling.preprocessing.StandardScaler¶

class snowflake.ml.modeling.preprocessing.StandardScaler(*, with_mean: bool = True, with_std: bool = True, input_cols: Optional[Union[str, Iterable[str]]] = None, output_cols: Optional[Union[str, Iterable[str]]] = None, drop_input_cols: Optional[bool] = False)¶

Bases: BaseTransformer

Standardizes features by removing the mean and scaling to unit variance. Values must be of float type.

For more details on what this transformer does, see sklearn.preprocessing.StandardScaler.

Args:

with_mean: If True, center the data before scaling. with_std: If True, scale the data unit variance (i.e. unit standard deviation). input_cols: The name(s) of one or more columns in a DataFrame containing a feature to be scaled. output_cols: The name(s) of one or more columns in a DataFrame in which results will be stored. The number of

columns specified must match the number of input columns.

drop_input_cols: Remove input columns from output if set True. False by default.

Attributes:
scale_: Dictionary mapping input column names to relative scaling factor to achieve zero mean and unit variance.

If a variance is zero, unit variance could not be achieved, and the data is left as-is, giving a scaling factor of 1. None if with_std is False.

mean_: Dictionary mapping input column name to the mean value for that feature. None if with_mean is False. var_: Dictionary mapping input column name to the variance for that feature. Used to compute scale_. None if

with_std is False

Methods

fit(dataset)

Compute mean and std values of the dataset.

transform(dataset)

Perform standardization by centering and scaling.