NORMALIZE

Runs a normalization algorithm on an input table or view. The output is a view with the normalized data.

Note: This function differs from NORMALIZE_FIT, which creates and stores a model rather than creating a view definition. This could lead to different performance characteristics between the two algorithms.

Important: Before using a machine learning function, be aware that all the ongoing transactions might be committed.

Syntax

NORMALIZE ( 'output_view', 'input_relation', 'input_columns', 'normalization_method'
            [ USING PARAMETERS [exclude_columns= 'col1, col2, ... coln '] ]
                              

                

Arguments

output_view

The name of the View where you save the normalized data from the chosen input_columns.

input_relation

The table or view that contains the data to be normalized.

input_columns

A comma-separated list of the columns in the input_relation containing the values to be normalized.

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:

  • minmax
  • zscore
  • robust_zscore

If infinity values appear in the table, the method ignores those values.

Parameters

exclude_columns=col1, col2, ... coln

(Optional) The columns from input_relation that you want to exclude from the input_columns argument.

Privileges

To use NORMALIZE, 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 function on the wt and hp columns in the mtcars table.

Execute the NORMALIZE function, and specify the minmax method:

=> SELECT NORMALIZE('mtcars_norm', 'mtcars',
                    'wt, hp', 'minmax');
        NORMALIZE
--------------------------
 Finished in 1 iteration

(1 row)

Execute the NORMALIZE function, and specify the zscore method:

=> SELECT NORMALIZE('mtcars_normz','mtcars',
                    'wt, hp', 'zscore');
        NORMALIZE
--------------------------
 Finished in 1 iteration

(1 row)

Execute the NORMALIZE function, and specify the robust_zscore method:

=> SELECT NORMALIZE('mtcars_normz', 'mtcars',
                    'wt, hp', 'robust_zscore');
        NORMALIZE
--------------------------
 Finished in 1 iteration

(1 row)

See Also