psiphy.utils
Kernel Density Estimation
Written around the KDE code in scikit-learn package.
- psiphy.utils.kernel_density.bandwidth_kde_silverman(X)[source]
h_ii = (4/(d+2))**(1/(d+4)) n**(-1/(d+4)) sigma_i
- psiphy.utils.kernel_density.bandwidth_kdeCV(X, kde=None, bw=array([0.01, 0.01151395, 0.01325711, 0.01526418, 0.01757511, 0.0202359, 0.02329952, 0.02682696, 0.03088844, 0.0355648, 0.04094915, 0.04714866, 0.05428675, 0.06250552, 0.07196857, 0.08286428, 0.09540955, 0.10985411, 0.12648552, 0.14563485, 0.16768329, 0.19306977, 0.22229965, 0.25595479, 0.29470517, 0.33932218, 0.39069399, 0.44984327, 0.51794747, 0.59636233, 0.68664885, 0.79060432, 0.91029818, 1.04811313, 1.20679264, 1.38949549, 1.59985872, 1.84206997, 2.12095089, 2.44205309, 2.8117687, 3.23745754, 3.72759372, 4.29193426, 4.94171336, 5.68986603, 6.55128557, 7.54312006, 8.68511374, 10.]), cv=1, verbose=True, kernel='gaussian', metric='euclidean', atol=0, leaf_size=40)[source]
Estimate the bandwidth using cross validation.
- psiphy.utils.kernel_density.cross_val_loss_kdeCV_loo(h)=\int \hat{f}^2_n(x)dx - 2\int \hat{f}(x)f(x)dx \hat{J}(h) = \int \hat{f}^2_n(x)dx - rac{2}{n}\sum \hat{f}_{-i}(x_i)[source]
- psiphy.utils.kernel_density.cross_val_loss_kdeCV_kFold(h)=\int \hat{f}^2_n(x)dx - 2\int \hat{f}(x)f(x)dx \hat{J}(h) = \int \hat{f}^2_n(x)dx - rac{2}{n}\sum \hat{f}_{-i}(x_i)[source]
- psiphy.utils.sampling_space.LH_sampling(n_params=2, samples=10, mins=0, maxs=1, outfile=None)[source]
- psiphy.utils.sampling_space.MC_sampling(n_params=2, samples=10, mins=0, maxs=1, outfile=None)[source]