1.1 - 8.10 - ScaleByPartition Example - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

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 from the attachment in the left sidebar.