TD_OneHotEncodingFit Example | Teradata Vantage - TD_OneHotEncodingFit Example - Teradata® Database

Database Analytic Functions

Product
Teradata® Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
Teradata_Vantage™___Advanced_SQL_Engine_Analytic_Functions.withLogo_upload_July2021/wnd1589838592459.ditamap
dita:ditavalPath
Teradata_Vantage™___Advanced_SQL_Engine_Analytic_Functions.withLogo_upload_July2021/ayr1485454803741.ditaval
dita:id
B035-1206
lifecycle
previous
Product Category
Teradata Vantage™

InputTable: input_table

Every complete example in this document is available in a zip file that you can download. The zip file includes a SQL script file that creates the input tables for the examples. If you are reading this document on https://docs.teradata.com/, you can download the zip file from the attachment in the left sidebar.

Passenger Survived Pclass Name               Age Sex    
 --------- -------- ------ ------------------ --- ------ 
         1        0      3 Mr. Owen Harris     22 Male  
         2        1      1 Mrs. John Bradley   38 Female
         3        1      3 Mrs. Laina          26 Female
         4        0      3 Mrs. Jacques Heath  35 Female

SQL Call

CREATE TABLE onehotencodingfit_output AS (
  SELECT * FROM TD_OneHotEncodingFit (
    ON onehotencodingfit_input AS InputTable
    USING
    TargetColumn ('Sex')
    OtherColumnName ('other')
    CategoricalValues ('male', 'female')
    IsInputDense ('true')
  ) AS dt
) WITH DATA;

Output

Sex  Sex_male Sex_female Sex_other 
 ---- -------- ---------- --------- 
 null  male     female     null