test_populationstrategy.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:pyabc 作者: neuralyzer 项目源码 文件源码
def test_one_with_one_without_parameters(population_strategy:
                                         PopulationStrategy):
    n = 10
    kernels = []

    df_without = pd.DataFrame(index=list(range(n)))
    w_without = sp.ones(n) / n
    kernel_without = MultivariateNormalTransition()
    kernel_without.fit(df_without, w_without)
    kernels.append(kernel_without)

    df_with = pd.DataFrame([{"s": sp.rand()} for _ in range(n)])
    w_with = sp.ones(n) / n
    kernel_with = MultivariateNormalTransition()
    kernel_with.fit(df_with, w_with)
    kernels.append(kernel_with)

    population_strategy.adapt_population_size(kernels, sp.array([.7, .3]))
    assert population_strategy.nr_particles > 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号