test_Bayesian.py 文件源码

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

项目:F_UNCLE 作者: fraserphysics 项目源码 文件源码
def test_mult_simPQ(self):
        """Test the sensitivity calculation for multiple experiments
        """

        new = self.bayes.update(simulations={'simple1': [self.sim1, self.exp1],
                                             'simple2': [self.sim1, self.exp1]})

        initial_data = new.get_data()
        sens_matrix = new._get_sens(initial_data=initial_data)

        P, q = new._get_sim_pq(initial_data, sens_matrix)

        sigma = self.exp1.get_sigma()

        P_true = np.dot(np.dot(sens_matrix['simple1'].T,
                               inv(sigma)),
                        sens_matrix['simple1'])
        P_true += P_true

        npt.assert_array_almost_equal(P, P_true, decimal=8)

        epsilon = new.simulations['simple1']['exp'].\
                  compare(initial_data['simple1'])

        q_true = -np.dot(np.dot(epsilon, inv(sigma)), sens_matrix['simple1'])
        q_true += q_true
        npt.assert_array_almost_equal(q, q_true, decimal=8)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号