【正文】
C, CK}; 基亍 LB_Hust 距離矩陣的層次聚類 ? 算法流程: ? 1) 初始狀態(tài)下所有時間序列數據自成一簇,每條時間序列數據為各自的簇中心,初始化距離矩陣,計算任意兩條時間序列數據間的距離,循環(huán) 2)到 5)。 ? 3) 根據時間序列數據上下界曲線形成方法求取當前簇中心的上下界索引序列 Us、 Ls。 ? 5) 若當前聚類簇數達到 K,則終止,否則轉到 2)。 應用 股票數據聚類 ? 股票數據作為典型的時間序列數據,被眾多時間序列挖掘方法作為實驗性數據。 ? 對于多支股票的聚類是從控股公司間的經營狀況、經營手段及外界影響因素的相似程度進行聚類。 股票數據聚類:數據準備 ? 采用搜狐財經網 (股票歷史行情數據作為實驗數據,從中選擇 29 支股票作為實驗數據:寶鋼股份、包鋼股份、上海電力、招商輪船、中國石油 、中國銀行、中海油服、武鋼股份、東湖高新、萬東醫(yī)療、林海股份、中視傳媒等。 ? 抽取從 2023年 3月份到 2023年五月份的股票歷史行情數據,將其中的每日收盤價作為實驗數據。 股票數據聚類:數據準備 ? 股票數據普遍存在空值,主要是基于兩種情況:一、正常的股市休市。 ? 每支股票數據在休市時都是空值,因此可采用直接刪除的方法不會影響到時間序列的時間對等性。填補數據根據線性化函數取得,對每個空值,以空值上下非空數據為端點得到一次線性化函數,通過線性化函數可以取得空值對應時間點的股價。 ? 其次,從實際意義來看,在空值出現前的階段和空值結束后,兩者股價一般不同,可見在股價為空值的階段,實際上隱藏著一些影響股價變動的因素發(fā)生著作用,通過線性化函數,將期間出現的變化過程連續(xù)的表達出來,函數中的斜率保持了股價在空值出現階段的趨勢變動變化規(guī)律,通過這種填補方法使得股價波動曲線更連續(xù)和平滑 股票數據聚類:數據的歸一化 ? 除了空值問題,股票數據另一典型的特點就是不同公司的股價在數值上差異很大。 股票數據聚類:聚類結果 ? 運行層次聚類算法時初始設定聚類簇數為 4個,同時設定時間彎折窗口 w為 3。 股票數據聚類:聚類結果 ? 運行層次聚類算法時初始設定聚類簇數為 4個,同時設定時間彎折窗口 w為 3。 基亍 SAX表示的聚類 ? Hierarchical Clustering – Compute pairwise distance, merge similar clusters bottomup – Compared with Euclidean, IMPACTS, and SDA ? 基于 SAX表示的距離 PAA distance lowerbounds the Euclidean Distance 0 20 40 60 80 100 120 1 0 1 C Q 0 20 40 60 80 100 120 1 0 1 C Q = baabccbc C ? = babcacca Q ? ? ? ? ?? ???ni iicqCQD12,Euclidean Distance ? ?? ? ?? wi iiwn cqCQDR 1 2),( ? ????wi iiwn cqdistCQMINDIST12)?,?()?,?(dist() can be implemented using a table lookup. Hierarchical Clustering E u c li d e a n I MP A C T S ( a l p h a b e t = 8 ) S D A SAX We can objectively state that SAX is superior, since it correctly assigns each class to its own subtree. 數據類別事先已知: decreasing trend, upward shift and normal classes Clustering ? Hierarchical Clustering – Compute pairwise distance, merge similar clusters bottomup – Compared with Euclidean, IMPACTS, and SDA ? Partitional Clustering – Kmeans – Optimize the objective function by minimizing the sum of squared intracluster errors – Compared with Raw data – 比層次聚類具有更好的可伸縮性 Partitional (Kmeans) Clustering Working with an approximation of the data gives better results than working with the original data. It has been shown that initializing the clusters centers on a low dimension approximation of the data can improve the quality, this is what clustering with SAX implicitly does. N um ber of Ite rat i ons 2 2 0 0 0 0 2 2 5 0 0 0 2 3 0 0 0 0 2 3 5 0 0 0 2 4 0 0 0 0 2 4 5 0 0 0 2 5 0 0 0 0 2 5 5 0 0 0 2 6 0 0 0 0 2 6 5 0 0 0 1 2 3 4 5 6 7 8 9 10 11 R a w d a t a O u r Sym b o lic App r o a c h Objective Function R a w d a t a SAX A parison of the kmeans clustering algorithm using SAX and the raw data. The dataset was Space Shuttle telemetry,