Пример #1
0
    def test_low_n_ess_warning(self):
        n_particles = 1000
        updater = self._mk_updater(n_particles, resample_thresh=0.0)
        
        outcomes = np.array([0], dtype=int)
        expparams = np.ones((1,), dtype=self.model.expparams_dtype)
        expparams['alpha'][0] = 2 / 1000 # Force the particle number to be 2.

        with assert_warns(ApproximationWarning):
            updater.update(outcomes, expparams) 
Пример #2
0
    def test_low_n_ess_warning(self):
        n_particles = 1000
        updater = self._mk_updater(n_particles, resample_thresh=0.0)
        
        outcomes = np.array([0], dtype=int)
        expparams = np.ones((1,), dtype=self.model.expparams_dtype)
        expparams['alpha'][0] = 2 / 1000 # Force the particle number to be 2.

        with assert_warns(ApproximationWarning):
            updater.update(outcomes, expparams) 
Пример #3
0
 def test_assert_warns_nowarn(self):
     with assert_warns(RuntimeWarning):
         pass
Пример #4
0
 def test_assert_warns_ok(self):
     with assert_warns(RuntimeWarning):
         warnings.warn(RuntimeWarning("Test"))
Пример #5
0
 def test_assert_warns_nowarn(self):
     with assert_warns(RuntimeWarning):
         pass
Пример #6
0
 def test_assert_warns_ok(self):
     with assert_warns(RuntimeWarning):
         warnings.warn(RuntimeWarning("Test"))