TD_PolynomialFeaturesTransform Function Example | Teradata Vantage - Example: How to Use TD_PolynomialFeaturesTransform - Analytics Database

Database Analytic Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
gjn1627595495337.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
jmh1512506877710
Product Category
Teradata Vantageā„¢

TD_PolynomialFeaturesFit InputTable: polynomialFeaturesFit_input

InputTable: polynomialFeatures, as in Example: How to Use TD_PolynomialFeaturesFit

 id col1 col2 col3 
 -- ---- ---- ---- 
  1    2    3    4
  2    5    6    7
  3    1    2    4
  4    5    3    5
  5    3    2    6

TD_PolynomialFeaturesFit OutputTable: polynomialFit

FitTable: polynomialFit, created by Example: How to Use TD_PolynomialFeaturesFit

TD_PolynomialFeaturesFit Output
TD_INCLUDEBIAS_POLFIT:TRUE TD_INTERACTIONONLY_POLFIT:FALSE TD_DEGREE_POLFIT:2 col1 col2 
-------------------------- ------------------------------- ------------------ ---- ---- 
                1                               0                  2          NULL NULL

Example: Using TD_PolynomialFeaturesTransform SQL Call

SELECT * FROM TD_PolynomialFeaturesTransform (
  ON polynomialFeaturesFit_input AS InputTable PARTITION BY ANY
  ON polynomialFit AS FitTable DIMENSION
  USING
  Accumulate ('[0:0]')
) AS dt;

TD_PolynomialFeaturesTransform Output

 id   ONE   col1  col1_col2  col1_SQUARE  col2   col2_SQUARE  
 --   ---   ----  ---------  -----------  ----   -----------
  1   1.0    2.0        6.0          4.0   3.0           9.0
  2   1.0    5.0       30.0         25.0   6.0          36.0
  3   1.0    1.0        2.0          1.0   2.0           4.0
  4   1.0    5.0       15.0         25.0   3.0           9.0
  5   1.0    3.0        6.0          9.0   2.0           4.0