When I do kernel density estimation using scipy, it seems that the bandwidth is a fixed value for the whole dataset, although I can set its value by my own.
def scotts_factor(self):
#Compute Scott's factor.
return power(self.neff, -1./(self.d+4))
self.covariance_factor = self.scotts_factor
self.factor = self.covariance_factor() #get the value of bandwidth
By the way, I have checked the code in sklearn to do kernel density estimation, and the code is like belows:
kde = KernelDensity(kernel='gaussian', bandwidth=0.2).fit(X)
Seems for the dataset X, they also shared a common bandwidth.
Therefore, the whole dataset shared a common bandwidth value. And if I want set different bandwidth for every point in a scatterplot, what should I do?