NORMALIZE_FIT
Computes normalization parameters for each of the specified columns in an input table or view. The resulting model stores the normalization parameters. For example, for MinMax normalization, the minimum and maximum value of each column are stored in the model. The generated model will serve as input to the functions APPLY_NORMALIZE and REVERSE_NORMALIZE.
For robust_zscore, NORMALIZE_FIT uses the APPROXIMATE_MEDIAN [Aggregate] function.
This function differs from NORMALIZE, which directly outputs a view with normalized results, rather than storing normalization parameters into a model for later operation.
Important: Before using a machine learning function, be aware that all the ongoing transactions might be committed.
Syntax
NORMALIZE_FIT ( 'model_name', 'input_relation', 'input_columns', 'normalization_method' [USING PARAMETERS [exclude_columns='col1, col2, ... coln',] [output_view='output_view'] ] )
Arguments
model_name |
The name of the model. Model names are case-insensitive. |
input_relation |
The table or view that contains the data to be normalized. |
input_columns |
A comma-separated list of the columns in To include all of the columns from the input_relation, specify this argument as a wildcard (*). |
normalization_method |
The normalization method to use. Valid Values:
If infinity values, negative infinity values, or NULL values appear in the table, the method ignores those values. |
Parameters
exclude_columns='col1, col2, ... coln' |
(Optional) The columns from the input_relation that you want to exclude from the input_columns argument. |
output_view = output view |
(Optional) The name of the View that contains all columns from the input_relation , with the specified input_columns normalized. |
Privileges
To use NORMALIZE_FIT, you must either be a superuser or have CREATE privileges for the schema of the output view and SELECT privileges for the input table or view.
See GRANT (Schema) and GRANT (Table).
Examples
These examples show how you can use the NORMALIZE_FIT function on the wt
and hp
columns in the mtcars table.
Execute the NORMALIZE_FIT function, and specify the minmax
method:
=> SELECT NORMALIZE_FIT('mtcars_normfit', 'mtcars', 'wt,hp', 'minmax');
NORMALIZE_FIT
---------------
Success
(1 row)
Execute the NORMALIZE_FIT function, and specify the zscore
method:
=> SELECT NORMALIZE_FIT('mtcars_normfitz', 'mtcars', 'wt,hp', 'zscore');
NORMALIZE_FIT
---------------
Success
(1 row)
Execute the NORMALIZE_FIT function, and specify the robust_zscore
method:
=> SELECT NORMALIZE_FIT('mtcars_normfitrz', 'mtcars', 'wt,hp', 'robust_zscore');
NORMALIZE_FIT
---------------
Success
(1 row)