问题
I am usingsns.kdeplot(data)
to obtain a Kernel Density Estimate for my 1 dimensional dataset.
As I understand and having read seaborn's documentation on kdeplot, sns.kdeplot() passes bw_method="Scott"
to scipy.stats.gaussian_kde
to automatically obtain a rule-based bandwidth to smoothening the kde plot in question.
Can I access the bandwidth that was automatically used by seaborn for its kdeplot? My idea was to reproduce seaborn's steps through scipy.stats.gaussian_kde and applying the rule as per documentation len(data)**(-1./(1+4))
(Scott's rule) to obtain a value for bw, but I find the obtained value to produce a visually different kdeplot to seaborn's plot. In other words, what is the bw_rule, so that sns.kdeplot(data,bw=bw_rule) == sns.kdeplot(data)
?
来源:https://stackoverflow.com/questions/65461136/can-i-retrieve-the-bandwidth-used-in-a-seaborn-kdeplot