ScaleByPartition Example | Teradata Vantage - ScaleByPartition Example - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

This example scales the sequences in each partition independently.

Input

SQL Call

SELECT * FROM ScaleByPartition (
  ON scale_housing PARTITION BY types
  USING
  TargetColumns ('[2:6]')
  ScaleMethod ('maxabs')
  Accumulate ('types','id')
) AS dt ORDER BY 1 desc,2;

Output

 types    id price              lotsize             bedrooms           bathrms stories 
 -------- -- ------------------ ------------------- ------------------ ------- ------- 
 classic   1 0.6885245901639344  0.8796992481203008                1.0     1.0     1.0
 classic   2               NULL  0.6015037593984962 0.6666666666666666     1.0     0.5
 classic   3 0.8114754098360656 0.46015037593984964                1.0     1.0     0.5
 classic   4 0.9918032786885246                 1.0                1.0     1.0     1.0
 classic   5                1.0   0.956390977443609 0.6666666666666666     1.0     0.5
 bungalow  6 0.7457627118644068  0.7563636363636363                1.0     0.5    0.25
 bungalow  7 0.7457627118644068  0.7054545454545454               NULL     1.0     0.5
 bungalow  8 0.7796610169491526  0.7563636363636363                1.0     0.5    0.75
 bungalow  9 0.9468926553672317  0.8727272727272727                1.0     0.5    0.25
 bungalow 10                1.0                 1.0                1.0     1.0     1.0

Download a zip file of all examples and a SQL script file that creates their input tables.