丁義 楊建



摘? 要: 相似性度量是綜合評定兩個數據樣本之間差異的指標,歐式距離是較為常用的相似性度量方法之一。本文分析了歐式距離與標準化的歐式距離在KNN算法中對數據分類的影響。仿真實驗結果表明,當向量之間的各維度的尺度差別較大時,標準化的歐式距離較好地改善了分類的性能。
關鍵詞: 歐式距離;標準化歐式距離;K近鄰算法
中圖分類號: TP311? ? 文獻標識碼: A? ? DOI:10.3969/j.issn.1003-6970.2020.10.033
本文著錄格式:丁義,楊建. 歐式距離與標準化歐式距離在k近鄰算法中的比較[J]. 軟件,2020,41(10):135136+140
【Abstract】: Similarity measurement is an index to evaluate the difference between two data samples. Euclidean distance is one of the most common similarity measurement methods. This paper analyzes the influence of Euclidean distance and standardized Euclidean distance on data classification in KNN algorithm. The simulation results show that the normalized Euclidean distance improves the classification performance as the scales of the dimensions between vectors differ greatly.
【Key words】: Euclidean distance; Standardized Euclidean distance; K-nearest neighbor algorithm
0? 引言
K近鄰(k-Nearest Neighbor,KNN)算法[1],是一種理論上比較成熟的方法,也是最簡單的機器學習算法之一,獲得了廣泛的實際應用[2-5]。KNN算法的基本思想是,在特征空間中,如果一個樣本附近的k個最鄰近樣本的大多數屬于某一個類別,則該樣本也屬于這個類別。即給定一個訓練數據集,對新的輸入樣本,在訓練數據集中找到與該樣本最鄰近的k個樣本如果這k個樣本中大多數屬于某一個類別,就把該輸入樣本分類到這個類別中。目前,KNN在分類算法中獲得了廣泛的應用。KNN是一種基于實例的學習算法,它不同于決策樹、貝葉斯網絡等算法。決策樹算法是一種逼近離散函數值的方法,它首先對待分類的數據進行預處理,之后用歸納算法生成規則和決策樹。貝葉斯網絡又稱為置信網絡或信念網絡,它是基于有向無環圖來刻畫屬性之間的依賴關系的一種網絡結構,使用條件概率表來描述變量的聯合概率分布。……