LinRegPredict Example - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.10
1.1
Published
October 2019
Language
English (United States)
Last Update
2019-12-31
dita:mapPath
ima1540829771750.ditamap
dita:ditavalPath
jsj1481748799576.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

Input

  • InputTable: housing_data, as in the Linear Regression Example
  • Model: LinRegModel, is the output of the Linear Regression Example, created as follows:
CREATE MULTISET TABLE LinRegModel AS (
  SELECT * FROM LinReg (
    ON LinRegInternal (
      ON housing_data
    ) AS dt1 PARTITION BY 1
  ) AS dt2
) WITH DATA;

SQL Call

SELECT * FROM LinRegPredict ( 
  ON housing_data AS InputTable PARTITION BY ANY
  ON LinRegModel AS Model DIMENSION
  USING
  InputColumns ('housesize','lotsize','bedrooms','granite','upgradedbathroom')
  Accumulate ('housesize','lotsize','bedrooms','granite','upgradedbathroom')
) AS dt ORDER BY 1;

Output

 housesize lotsize bedrooms granite upgradedbathroom predicted_value    
 --------- ------- -------- ------- ---------------- ------------------ 
      2200    9600        4       0                1 200178.65324449894
      2397   14156        4       1                0   187694.857118394
      2983    9365        5       0                1 221896.99717644157
      3198    9669        5       1                1 225173.25034326705
      3247   10061        5       1                1 226336.77540031952
      3529    9191        6       0                0 207205.14288160563
      3536   19994        6       1                1  325768.3674812864
      4032   10150        5       0                1 198619.20669745357

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.