2024-04-26 02:24:04 发布
网友
很抱歉问一个可能有一个非常明显的答案的问题,但我有点困惑,如何调整我可以与KDE平滑。我的代码在python中如下所示:
kde = scipy.stats.gaussian_kde(c) P_0 = kde(3) P_c = kde(c)
其中c只是一列数字,我想对上面的数字做一个积分(这对我的问题来说并不太重要)。我有点困惑,我将如何更改scipy中的scott/silverman方法,以允许一些过度/不足平滑。在
您似乎想调整set_bandwidth参数。该链接包含简单的示例代码,我将其简化为最基本的元素:
kde = stats.gaussian_kde(c) kde.set_bandwidth(bw_method=.3) P = kde(c)
所以基本上,带宽是通过kde.set_bandwidth(bw_method=X)调用来设置的,其中X通常是一个浮点或{},scott方法之一。完整的描述实际上表明bw_method:
kde.set_bandwidth(bw_method=X)
X
scott
bw_method
can be ‘scott’, ‘silverman’, a scalar constant or a callable. If a scalar, this will be used directly as kde.factor. If a callable, it should take a gaussian_kde instance as only parameter and return a scalar.
您似乎想调整set_bandwidth参数。该链接包含简单的示例代码,我将其简化为最基本的元素:
所以基本上,带宽是通过},
kde.set_bandwidth(bw_method=X)
调用来设置的,其中X
通常是一个浮点或{scott
方法之一。完整的描述实际上表明bw_method
:相关问题 更多 >
编程相关推荐