The following example assumes sparse input format for InputTable:
create multiset table scale_input_sparse (passenger int, attribute_column varchar(20), attribute_value real); insert into scale_input_sparse values (97, 'age', 71); insert into scale_input_sparse values (97, 'fare', 34.6542); insert into scale_input_sparse values (488, 'age', 58); insert into scale_input_sparse values (488, 'fare', 29.7); insert into scale_input_sparse values (505, 'age', 16); insert into scale_input_sparse values (505, 'fare', 86.5); insert into scale_input_sparse values (631, 'age', 80); insert into scale_input_sparse values (631, 'fare', 30); insert into scale_input_sparse values (873, 'age', 33); insert into scale_input_sparse values (873, 'fare', 5);
FitTable Generated with TD_ScaleFit Function
TD_STATTYPE_SCLFIT attribute_column attribute_value ------------------ ---------------- --------------- avg fare 3.71708400000000E 001 count fare 5.00000000000000E 000 globalscale_false fare NULL intercept fare 0.00000000000000E 000 location fare 5.00000000000000E 000 max fare 8.65000000000000E 001 min fare 5.00000000000000E 000 missvalue_KEEP fare NULL multiplier fare 1.00000000000000E 000 null fare 0.00000000000000E 000 scale fare 8.15000000000000E 001 ScaleMethodNumberMapping: [0:mean,1:sum,2:ustd,3:std,4:range,5:midrange,6:maxabs,7:rescale] fare 4.00000000000000E 000 sum fare 1.85854200000000E 002
TD_ScaleTransform SQL Call
SELECT * FROM TD_ScaleTransform( ON scale_input_sparse AS InputTable ON sparseScaleFitOut AS FitTable DIMENSION USING AttributeNameColumn('attribute_column') AttributeValueColumn('attribute_value') Accumulate('passenger') )as dt2 order by 1,2;
TD_ScaleTransform Output
passenger attribute_column attribute_value --------- ---------------- --------------- 97 fare 0.363855214723926 488 fare 0.303067484662577 505 fare 1.00000000000000E 000 631 fare 0.306748466257669 873 fare 0.00000000000000E 000