class_docstr: Base class for Contextual Bandit Offline Evaluation algorithms. All algorihtms support evaluation of non-stationary
      policies, as required for exploration-exploitation.
class_docstr_tok: ["Base","class","for","Contextual","Bandit","Offline","Evaluation","algorithms",".","All","algorihtms","support","evaluation","of","non-stationary","policies",",","as","required","for","exploration-exploitation","."]
docstr: Ingest the batch of data and:
  1. Call self._process_all_data() and self._process_used_data() methods
  2. Modify the batch, zeroing out the weights for observations in which the logged and model actions don't match.
  
  TODO: support more general logic for zero-ing out the weights (e.g. as required by Doubly Robust - Non-Stationary)
  TODO: remove rows instead of zero-ing out weights (to speed up processing)
  
  Inputs:
      batch: A batch of training data
      model_actions: A tensor of actions chosen by the evaluated model
docstr_tok: ["Ingest","the","batch","of","data","and",":","1",".","Call","self._process_all_data","(",")","and","self._process_used_data","(",")","methods","2",".","Modify","the","batch",",","zeroing","out","the","weights","for","observations","in","which","the","logged","and","model","actions","do","n't","match",".","TODO",":","support","more","general","logic","for","zero-ing","out","the","weights","(","e.g",".","as","required","by","Doubly","Robust","-","Non-Stationary",")","TODO",":","remove","rows","instead","of","zero-ing","out","weights","(","to","speed","up","processing",")","Inputs",":","batch",":","A","batch","of","training","data","model_actions",":","A","tensor","of","actions","chosen","by","the","evaluated","model"]
code: def ingest_batch(
      self,
      batch: CBInput,
      model_actions: torch.Tensor,
  ) -> CBInput:
      """
      Ingest the batch of data and:
      1. Call self._process_all_data() and self._process_used_data() methods
      2. Modify the batch, zeroing out the weights for observations in which the logged and model actions don't match.
  
      TODO: support more general logic for zero-ing out the weights (e.g. as required by Doubly Robust - Non-Stationary)
      TODO: remove rows instead of zero-ing out weights (to speed up processing)
  
      Inputs:
          batch: A batch of training data
          model_actions: A tensor of actions chosen by the evaluated model
      """
      self._process_all_data(batch)
      new_batch = add_importance_weights(
          batch, model_actions, self.max_importance_weight
      )
      self._process_used_data(new_batch)
      return new_batch
  
imports: import copy
  import logging
  from abc import ABC, abstractmethod
  from typing import Optional
  import torch
  from pytorch_lightning.loggers import LightningLoggerBase
  from reagent.core.types import CBInput
  from reagent.core.utils import get_rank
  from reagent.evaluation.cb.utils import add_importance_weights
label_desc: Use image node_id 2 for calling the BaseOfflineEval obj's underlying member method code with example usage: obj.ingest_batch(batch, model_actions) and returns: new_batch