class_docstr: Metropolis-Hastings sampling step
  
  Parameters
  ----------
  S : standard deviation or covariance matrix
    Some measure of variance to parameterize proposal distribution
  proposal_dist : function
    Function that returns zero-mean deviates when parameterized with
    S (and n). Defaults to normal.
  scaling : scalar or array
    Initial scale factor for proposal. Defaults to 1.
  tune : bool
    Flag for tuning. Defaults to True.
  tune_interval : int
    The frequency of tuning. Defaults to 100 iterations.
class_docstr_tok: ["Metropolis-Hastings","sampling","step","Parameters","--","--","--","--","--","S",":","standard","deviation","or","covariance","matrix","Some","measure","of","variance","to","parameterize","proposal","distribution","proposal_dist",":","function","Function","that","returns","zero-mean","deviates","when","parameterized","with","S","(","and","n",")",".","Defaults","to","normal",".","scaling",":","scalar","or","array","Initial","scale","factor","for","proposal",".","Defaults","to","1.","tune",":","bool","Flag","for","tuning",".","Defaults","to","True",".","tune_interval",":","int","The","frequency","of","tuning",".","Defaults","to","100","iterations","."]
code: def __init__(
      self,
      model,
      discrete=False,
      S=None,
      proposal_dist=None,
      scaling=1.0,
      tune=True,
      tune_interval=100,
  ):
      if S is None:
          S = np.ones(model.get_dim())
  
      if proposal_dist is not None:
          self.proposal_dist = proposal_dist(S)
      elif S.ndim == 1:
          self.proposal_dist = NormalProposal(S)
      elif S.ndim == 2:
          self.proposal_dist = MultivariateNormalProposal(S)
      else:
          raise ValueError("Invalid rank for variance: %s" % S.ndim)
  
      self.model = model
      self.scaling = np.atleast_1d(scaling).astype("d")
      self.tune = tune
      self.tune_interval = tune_interval
      self.steps_until_tune = tune_interval
      self.accepted = 0
      self.discrete = discrete
  
      super(Metropolis, self).__init__()
  
imports: from __future__ import division
  import scipy.linalg
  import numpy
  import numpy.random
label_desc: Use image node_id 1 to create a new Metropolis object from inherited base classes: object with example: obj = Metropolis(model, discrete, S, proposal_dist, scaling, tune, tune_interval)