1.0 - 8.00 - Scale Example 4: Multiple Methods - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

This example scales input data using multiple methods—midrange, mean, maxabs, and range—in the same function call.

Input

  • Training data: scale_housing, as in Scale Example 1: ScaleMethod ('midrange')
  • Test data: tmpScale, created with this statement:
    CREATE MULTISET table tmpScale AS (
      SELECT * FROM ScaleMap (
      ON scale_housing
      USING
      TargetColumns ('[2:6]')
      MissValue ('omit')
      ) AS dt 
    ) WITH DATA;

SQL Call

SELECT * FROM Scale (
  ON scale_housing AS "input" PARTITION BY ANY
  ON tmpScale AS statistic DIMENSION
  USING
  ScaleMethod ('midrange','mean','maxabs','range')
  Accumulate ('id')
) AS dt ORDER BY id, price, lotsize;

Output

id price lotsize bedrooms bathrms stories scalemethod
1 0.474576271186441 0.879699248120301 1 0.5 0.5 maxabs
1 -23144.4444444444 1008 0.222222222222222 -0.2 0.2 mean
1 -1 0.554317548746518 1 -1 -0.333333333333333 midrange
1 0 0.777158774373259 1 0 0.333333333333333 range
2   0.601503759398496 0.666666666666667 0.5 0.25 maxabs
2   -842 -0.777777777777778 -0.2 -0.8 mean
2   -0.476323119777159 -1 -1 -1 midrange
2   0.261838440111421 0 0 0 range
3 0.559322033898305 0.46015037593985 1 0.5 0.25 maxabs
3 -15644.4444444444 -1782     -0.8 mean
    -1     -1 midrange
    0     0 range
... ... ... ... ... ... ...