Scale Example 2: ScaleMethod ('midrange'), Intercept (-min) - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

This example is like Example 1 except that the Intercept argument has the value -min (where min is the global minimum value). This example also specifies a Multiplier value, but it is the default, as in Example 1.

Input

  • input: scale_housing, as in Scale Example 1: ScaleMethod ('midrange')
  • statistic: scale2, created with this statement:
    CREATE MULTISET table scale2 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 scale2 AS statistic DIMENSION
  USING
  ScaleMethod ('midrange')
  Accumulate ('id')
  Intercept('-min')
  Multiplier(1)
) AS dt ORDER BY id, price, lotsize;

Output

As explained in the description of the Intercept argument, this is the formula for computing the scaled value X' from the input value X when intercept is -min:

X' = - scaledmin + 1 * (X - location)/scale

This is the formula for computing scaledmin when intercept is -min:

scaledmin = (minX - location)/scale

For example, consider row 1 of the price column in the input table and the following output table:

Item Value
Input value X 42000
Minimum input price value minX 42000
Maximum input price value maxX 88500
location (88500+42000)/2 = 65250
scale (88500-42000)/2 = 23250
scaledmin (42000 - 65250)/23250 = -1
Scaled output value X' -(-1) + 1 * (42000 - 65250)/23250 = 0
id price lotsize bedrooms bathrms stories
1 0 1.55431754874652 2 0 0.666666666666667
3 0.32258064516129 0 2 0 0
4 0.795698924731183 2 2 0 0.666666666666667
5 0.817204301075269 1.83844011142061 0 0 0
6 1.03225806451613 0.612813370473538 2 0 0
8 1.16129032258065 0.612813370473538 2 0 1.33333333333333
9 1.79784946236559 0.969359331476323 2 0 0
10 2 1.35933147632312 2 2 2
1 0 1.55431754874652 2 0 0.666666666666667
3 0.32258064516129 0 2 0 0