class_docstr: Utility for collecting samples into a dictionary.
  
  Name comes from its similarity to ``defaultdict``:
  entries are lazily created.
  
  Parameters
  ----------
  samples : int
      The number of samples that will be collected, per variable,
      into the trace.
  
  Attributes
  ----------
  trace_dict : Dict[str, np.ndarray]
      A dictionary constituting a trace.  Should be extracted
      after a procedure has filled the `_DefaultTrace` using the
      `insert()` method
docstr: Insert `v` as the value of the `idx`th sample for the variable `k`.
  
  Parameters
  ----------
  k: str
      Name of the variable.
  v: anything that can go into a numpy array (including a numpy array)
      The value of the `idx`th sample from variable `k`
  ids: int
      The index of the sample we are inserting into the trace.
docstr_tok: ["Insert","`","v","`","as","the","value","of","the","`","idx","`","th","sample","for","the","variable","`","k","`",".","Parameters","--","--","--","--","--","k",":","str","Name","of","the","variable",".","v",":","anything","that","can","go","into","a","numpy","array","(","including","a","numpy","array",")","The","value","of","the","`","idx","`","th","sample","from","variable","`","k","`","ids",":","int","The","index","of","the","sample","we","are","inserting","into","the","trace","."]
code: def insert(self, k: str, v, idx: int):
      """
      Insert `v` as the value of the `idx`th sample for the variable `k`.
  
      Parameters
      ----------
      k: str
          Name of the variable.
      v: anything that can go into a numpy array (including a numpy array)
          The value of the `idx`th sample from variable `k`
      ids: int
          The index of the sample we are inserting into the trace.
      """
      value_shape = np.shape(v)
  
      # initialize if necessary
      if k not in self.trace_dict:
          array_shape = (self._len,) + value_shape
          self.trace_dict[k] = np.empty(
              array_shape, dtype=np.array(v).dtype
          )
  
      # do the actual insertion
      if value_shape == ():
          self.trace_dict[k][idx] = v
      else:
          self.trace_dict[k][idx, :] = v
  
imports: import logging
  import warnings
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Mapping, Optional, Tuple, Union
  import numpy
  from arviz import InferenceData, concat, rcParams
  from arviz.data.base import CoordSpec, DimSpec, dict_to_dataset, requires
  from pytensor.graph.basic import Constant
  from pytensor.tensor.sharedvar import SharedVariable
  import pymc
  from pymc.model import Model, modelcontext
  from pymc.pytensorf import extract_obs_data
  from pymc.util import get_default_varnames
label_desc: Use image node_id 2 for calling the _DefaultTrace obj's underlying member method code with example usage: obj.insert(k, v, idx) without return types