class_docstr: :param model: probabilistic model defined as a function
  :param guide: guide used for sampling defined as a function
  :param num_samples: number of samples to draw from the guide (default 10)
  
  This method performs posterior inference by importance sampling
  using the guide as the proposal distribution.
  If no guide is provided, it defaults to proposing from the model's prior.
class_docstr_tok: [":","param","model",":","probabilistic","model","defined","as","a","function",":","param","guide",":","guide","used","for","sampling","defined","as","a","function",":","param","num_samples",":","number","of","samples","to","draw","from","the","guide","(","default","10",")","This","method","performs","posterior","inference","by","importance","sampling","using","the","guide","as","the","proposal","distribution",".","If","no","guide","is","provided",",","it","defaults","to","proposing","from","the","model","'s","prior","."]
docstr: Constructor. default to num_samples = 10, guide = model
docstr_tok: ["Constructor",".","default","to","num_samples","=","10",",","guide","=","model"]
code: def __init__(self, model, guide=None, num_samples=None):
      """
      Constructor. default to num_samples = 10, guide = model
      """
      super().__init__()
      if num_samples is None:
          num_samples = 10
          warnings.warn(
              "num_samples not provided, defaulting to {}".format(
                  num_samples
              )
          )
      if guide is None:
          # propose from the prior by making a guide from the model by hiding observes
          guide = poutine.block(model, hide_types=["observe"])
      self.num_samples = num_samples
      self.model = model
      self.guide = guide
  
file_path: pyro/pyro/infer/importance.py
imports: import math
  import warnings
  import torch
  import pyro
  import pyro.poutine
  from pyro.ops.stats import fit_generalized_pareto
  from .abstract_infer import TracePosterior
  from .enum import get_importance_trace
label_desc: Use image node_id 1 to create a new Importance object from inherited base classes: TracePosterior with example: obj = Importance(model, guide, num_samples)