对极端值不敏感的归一化
--创建Rank临时表 CREATE MULTISET VOLATILE TABLE MEMBER_TDTL, NO LOG AS( SELECT Member_Id ,COUNT(1) AS TC ,DENSE_RANK() OVER(ORDER BY TC)AS Tc_Row FROM MEMBER_TRADE_PAYDTL GROUP BY Member_Id )WITH DATA PRIMARY INDEX(Member_Id,Tc_Row) ON COMMIT PRESERVE ROWS --归一化到固定范围分级,以10为例 SELECT Member_Id ,TC ,CAST(9*(Tc_Row-1)/(1.000*TR.Tc_Row_Max-1)+1 AS INT) AS Tc_Tile FROM MEMBER_USE_POINT_TDTL,( SELECT MAX(Tc_Row) AS Tc_Row_Max FROM MEMBER_USE_POINT_TDTL) TR
MEMBER_TRADE_PAYDTL源表就是一些交易订单,一笔交易一个记录