1. 程式人生 > 其它 >【686】核密度估計,kernel density estimation,KDE說明

【686】核密度估計,kernel density estimation,KDE說明

https://en.wikipedia.org/wiki/Kernel_density_estimation

核密度估計 Kernel Density Estimation(KDE)

Leveraging crowdsourced gps data for road extraction from aerial imagery

簡單理解:就是讓原本離散的點形成平滑的密度分佈情況

  • 最簡單的密度分佈就是直方圖,可以估計出離散點的分佈情況,設定不同的頻寬會形成不同的分佈直方圖,可以理解為不同的和密度函式,下圖就是對應的例子。雖然離散點不變,但是劃分規則不同,因此顯示出完全不同的分佈,這也說明對於不同核密度函式的選擇會產生不同的效果,因為是模擬,因此都有可能,且合適的核密度函式選擇很重要。

  • 關於核函式的選擇,有很多,平時最常用的就是高斯核函式,也就是正態分佈曲線,如下所示:

  • 下面是一個應用直方圖與高斯核函式的對比圖

    • For the histogram, first, the horizontal axis is divided into sub-intervals or bins which cover the range of the data: In this case, six bins each of width 2. Whenever a data point falls inside this interval, a box of height 1/12 is placed there. If more than one data point falls inside the same bin, the boxes are stacked on top of each other. (總體直方圖所佔據的面積總和是1)

    • For the kernel density estimate, normal kernels with standard deviation 2.25 (indicated by the red dashed lines) are placed on each of the data points xi. The kernels are summed to make the kernel density estimate (solid blue curve). The smoothness of the kernel density estimate (compared to the discreteness of the histogram) illustrates how kernel density estimates converge faster to the true underlying density for continuous random variables.(對於高斯核函式而言,因為一共6個點,因此每個點佔用的面積就是 1/6,然後最高點就是離散點的位置,這樣紅色虛線所組成的面積之和就是1,然後再將沒一個點的部分所有6個核函式的值進行求和,就得到了藍色的曲線,該曲線高度平滑,可以平滑的展示離散點的分佈。這就是核密度估計。)

  • 上面介紹的事一維資料,顯示成二維曲線,下面是二維資料顯示為三維曲線

    • 左邊為軌跡散點圖,右邊為高斯核函式繪製的三維圖

    • 三維圖可以明顯看出資料分佈的平滑分佈,如果通過畫格子數數量的話,就是類似最下面直方圖的方法

  •    
  •