tommyod/KDEpy

Anisotropic KDEs via PCA

Open

#6 创建于 2018年11月11日

在 GitHub 查看
 (11 评论) (1 反应) (1 负责人)Jupyter Notebook (104 fork)auto 404
enhancementhelp wanted

仓库指标

Star
 (647 star)
PR 合并指标
 (PR 指标待抓取)

描述

Currently, the bandwidth in d dimensions is bw * np.eye(d)---the covariance matrix is a multiple of the identity. As a result, the KDE works best if anisotropic data is shifted, rotatated and scaled before sent into the algorithm.

Having a routine for this built into the library would be nice.

@blasern suggested implementing anisotropic KDE. We agree that the following might work:

  • Shift data to have mean zero. Call this transformation f.
  • Apply the whitening transformation using the PCA / SVD. Call this g.
  • Fit a KDE.
  • Transform back using f^{-1}(g^{-1}(D)), make sure to scale the volume to preserve an integral of unity (determinant of the transformation).
                KDE                       
     Data  -------------> KDE estimate    
                                          
        |                  |              
  g o f |                  |   f^-1 o g^-1
        |                  |              
        v                  v              
           ------------->                 
 Transformed    KDE      KDE estimate     
    Data                                  

The above would implement very general KDEs in arbitrary dimensions.

贡献者指南