def kl_est_sample(from_gen, of_gen, target_cells, constraints):
    [data] = from_gen.simulate_joint(target_cells, constraints)
    targeted_data = [(i, j, x) for ((i, j), x) in zip(target_cells, data)]
    from_assessment = from_gen.logpdf_joint(targeted_data, constraints)
    of_assessment   =   of_gen.logpdf_joint(targeted_data, constraints)
    return from_assessment - of_assessment
Estimate Kullback-Liebler divergence of `of_gen` from `from_gen`.
dataset/ETHPy150Open probcomp/bayeslite/src/geweke_testing.py/kl_est_sample