docstr: Initialises the object state, which is used to compute result precisions & precision bounds
  and provide metadata for explanation objects.
  
  Parameters
  ----------
  batch_size
      See :py:meth:`alibi.explainers.anchors.anchor_base.AnchorBaseBeam.anchor_beam` method.
  coverage_data
      See :py:meth:`alibi.explainers.anchors.anchor_base.AnchorBaseBeam._get_coverage_samples` method.
docstr_tok: ["Initialises","the","object","state",",","which","is","used","to","compute","result","precisions","&","precision","bounds","and","provide","metadata","for","explanation","objects",".","Parameters","--","--","--","--","--","batch_size","See",":","py",":","meth",":","`","alibi.explainers.anchors.anchor_base.AnchorBaseBeam.anchor_beam","`","method",".","coverage_data","See",":","py",":","meth",":","`","alibi.explainers.anchors.anchor_base.AnchorBaseBeam._get_coverage_samples","`","method","."]
code: def _init_state(
      self, batch_size: int, coverage_data: np.ndarray
  ) -> None:
      """
      Initialises the object state, which is used to compute result precisions & precision bounds
      and provide metadata for explanation objects.
  
      Parameters
      ----------
      batch_size
          See :py:meth:`alibi.explainers.anchors.anchor_base.AnchorBaseBeam.anchor_beam` method.
      coverage_data
          See :py:meth:`alibi.explainers.anchors.anchor_base.AnchorBaseBeam._get_coverage_samples` method.
      """
  
      prealloc_size = batch_size * self.sample_cache_size
      # t_ indicates that the attribute is a dictionary with entries for each anchor
      self.state: dict = {
          "t_coverage": defaultdict(lambda: 0.0),  # anchors' coverage
          "t_coverage_idx": defaultdict(
              set
          ),  # index of anchors in coverage set
          "t_covered_true": defaultdict(
              None
          ),  # samples with same pred as instance where t_ applies
          "t_covered_false": defaultdict(
              None
          ),  # samples with dif pred to instance where t_ applies
          "t_idx": defaultdict(
              set
          ),  # row idx in sample cache where the anchors apply
          "t_nsamples": defaultdict(
              lambda: 0.0
          ),  # total number of samples drawn for the anchors
          "t_order": defaultdict(
              list
          ),  # anchors are sorted to avoid exploring permutations
          # this is the order in which anchors were found
          "t_positives": defaultdict(
              lambda: 0.0
          ),  # nb of samples where result pred = pred on instance
          "prealloc_size": prealloc_size,  # samples caches size
          "data": np.zeros(
              (prealloc_size, coverage_data.shape[1]),
              coverage_data.dtype,
          ),  # samples caches
          "labels": np.zeros(
              prealloc_size,
          ),  # clf pred labels on raw_data
          "current_idx": 0,
          "n_features": coverage_data.shape[
              1
          ],  # data set dim after encoding
          "coverage_data": coverage_data,  # coverage data
      }
      self.state["t_order"][()] = ()
  
imports: import copy
  import logging
  from collections import defaultdict, namedtuple
  from typing import Callable, Dict, List, Optional, Set, Tuple
  import numpy
  from alibi.utils.distributions import kl_bernoulli
label_desc: Use image node_id 2 for calling the AnchorBaseBeam obj's underlying member method code with example usage: obj._init_state(batch_size, coverage_data) without return types