Exemple #1
0
    def __init__(self, input=None, db='ram', name='MCMC', **kwds):
        """Initialize an MCMC instance.

        :Parameters:
          - input : module, list, tuple, dictionary, set, object or nothing.
              Model definition, in terms of Stochastics, Deterministics, Potentials and Containers.
              If nothing, all nodes are collected from the base namespace.
          - db : string
              The name of the database backend that will store the values
              of the stochastics and deterministics sampled during the MCMC loop.
          - verbose : integer
              Level of output verbosity: 0=none, 1=low, 2=medium, 3=high
          - **kwds :
              Keywords arguments to be passed to the database instantiation method.
        """
        Sampler.__init__(self, input, db, name, calc_deviance=True, **kwds)

        self.step_method_dict = {}
        for s in self.stochastics:
            self.step_method_dict[s] = []

        self._state = [
            'status', '_current_iter', '_iter', '_tune_interval', '_burn',
            '_thin'
        ]
Exemple #2
0
    def __init__(self, input=None, db='ram', eps=.001, diff_order = 5, **kwds):
        if not scipy_imported:
            raise ImportError, 'Scipy must be installed to use NormApprox and MAP.'

        MAP.__init__(self, input, eps, diff_order)

        Sampler.__init__(self, input, db, reinit_model=False, **kwds)
        self.C = NormApproxC(self)
Exemple #3
0
    def __init__(self, input=None, db="ram", name="MCMC", calc_deviance=True, **kwds):
        """Initialize an MCMC instance.
        
        :Parameters:
          - input : module, list, tuple, dictionary, set, object or nothing.
              Model definition, in terms of Stochastics, Deterministics, Potentials and Containers.
              If nothing, all nodes are collected from the base namespace.
          - db : string
              The name of the database backend that will store the values
              of the stochastics and deterministics sampled during the MCMC loop.
          - verbose : integer
              Level of output verbosity: 0=none, 1=low, 2=medium, 3=high
          - **kwds :
              Keywords arguments to be passed to the database instantiation method.
        """
        Sampler.__init__(self, input, db, name, calc_deviance=calc_deviance, **kwds)

        self._sm_assigned = False
        self.step_method_dict = {}
        for s in self.stochastics:
            self.step_method_dict[s] = []

        self._state = ["status", "_current_iter", "_iter", "_tune_interval", "_burn", "_thin"]