TD_GLMPredict Examples | GLMPredict | Teradata Vantage - Examples: How to Use TD_GLMPredict - 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ā„¢

Example: TD_GLMPredict Using Credit Data

This example takes credit data and uses TD_GLM function to get a model. You can view the input and output in the TD_GLM example.

TD_GLMPredict Call for Credit Data

CREATE VOLATILE TABLE vt_glm_predict_credit_ex AS (
    SELECT * from TD_GLMPredict (
      ON credit_ex_merged AS INPUTTABLE
      ON td_glm_output_credit_ex AS Model DIMENSION
      USING
      IDColumn ('ID')
      Accumulate('Outcome')
    ) AS dt
) WITH DATA
ON COMMIT PRESERVE ROWS;

TD_GLMPredict Output for Credit Data

ID Prediction Outcome
61 1 1
297 0 0
631 0 0
122 1 1
... ... ...

Example: TD_GLMPredict Using Housing Data

This example takes raw housing data, and does the following:
  1. Uses TD_ScaleFit to standardize the data.
  2. Uses TD_ScaleTransform to transform the data.
  3. Uses TD_GLM to get a model.
  4. Uses TD_GLMPredict to predict target values.

You can view the input and output of steps 1 through 3 in the TD_GLM example.

TD_GLMPredict Call for Housing Data

CREATE VOLATILE TABLE vt_predict_cal_ex AS (
    SELECT * from TD_GLMPredict (
      ON cal_housing_ex_scaled AS INPUTTABLE
      ON td_glm_cal_ex AS Model DIMENSION
      USING
      IDColumn ('ID')
      Accumulate('MedHouseVal')
    ) AS dt
) WITH DATA
ON COMMIT PRESERVE ROWS;

TD_GLMPredict Output for Housing Data

ID Prediction MedHouseVal
2833 1.5762 0.6
5328 2.29801 2.775
5300 1.82705 3.5
12433 0.863867 0.664
... ... ...