The ML.POLYNOMIAL_EXPAND function

This document describes the ML.POLYNOMIAL_EXPAND function, which lets you calculate all polynomial combinations of the input features.

You can use this function with models that support manual feature preprocessing . For more information, see the following documents:

Syntax

ML.POLYNOMIAL_EXPAND(struct_numerical_features [, degree])

Arguments

ML.POLYNOMIAL_EXPAND takes the following arguments:

  • struct_numerical_features : a STRUCT value that contains the numerical input features to expand. You can specify less than or equal to 10 input features. Don't specify unnamed features or duplicate features.
  • degree : an INT64 value that specifies the highest degree of all combinations in the range of [1, 4] . The default value is 2 .

Output

ML.POLYNOMIAL_EXPAND returns a STRUCT<STRING> value that contain all polynomial combinations of the numerical input features with a degree no larger than the passed-in degree, including the original features. The field names of the output struct are concatenations of the original feature names.

Example

The following example calculates the polynomial expansion of two numerical features:

 SELECT 
  
 ML 
 . 
 POLYNOMIAL_EXPAND 
 ( 
 STRUCT 
 ( 
 2 
  
 AS 
  
 f1 
 , 
  
 3 
  
 AS 
  
 f2 
 )) 
  
 AS 
  
 output 
 ; 

The output looks similar to the following:

+-------------------------------------------------------------------+
|                              output                               |
+-------------------------------------------------------------------+
| {"f1":"2.0","f1_f1":"4.0","f1_f2":"6.0","f2":"3.0","f2_f2":"9.0"} |
+-------------------------------------------------------------------+

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: