コード例 #1
0
    def test_compute_lrt_fails_when_garbage_goes_in(self):
        pe = ParameterEstimation()
        t0 = [2.0]

        with pytest.raises(TypeError):
            pe.compute_lrt(self.lpost, t0, None, t0)

        with pytest.raises(ValueError):
            pe.compute_lrt(self.lpost, t0[:-1], self.lpost, t0)
コード例 #2
0
    def test_compute_lrt_fails_when_garbage_goes_in(self):
        pe = ParameterEstimation()
        t0 = [2.0]

        with pytest.raises(TypeError):
            pe.compute_lrt(self.lpost, t0, None, t0)

        with pytest.raises(ValueError):
            pe.compute_lrt(self.lpost, t0[:-1], self.lpost, t0)
コード例 #3
0
    def test_compute_lrt_computes_deviance_correctly(self):
        t0 = [2.0]
        pe = ParameterEstimation()

        delta_deviance = pe.compute_lrt(self.lpost, t0, self.lpost, t0)

        assert delta_deviance < 1e-7
コード例 #4
0
    def test_compute_lrt_sets_max_post_to_false(self):
        t0 = [2.0]
        pe = ParameterEstimation(max_post=True)

        assert pe.max_post is True
        delta_deviance = pe.compute_lrt(self.lpost, t0, self.lpost, t0)

        assert pe.max_post is False
コード例 #5
0
    def test_compute_lrt_computes_deviance_correctly(self):
        t0 = [2.0]
        pe = ParameterEstimation()

        delta_deviance, opt1, opt2 = pe.compute_lrt(self.lpost, t0,
                                                    self.lpost, t0)

        assert delta_deviance < 1e-7
コード例 #6
0
    def test_compute_lrt_sets_max_post_to_false(self):
        t0 = [2.0]
        pe = ParameterEstimation(max_post=True)

        assert pe.max_post is True
        delta_deviance = pe.compute_lrt(self.lpost, t0, self.lpost, t0)

        assert pe.max_post is False