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 | ||||
... | ... | ... | ... | ... | ... | ... |