class_docstr: The Minimal Targeted Counterfactual generator for tabular data.
  
  This generator looks for counterfactuals that are close to the original input
  without using gradients. First, the generator finds counterfactual examples
  from the dataset. Then, it changes features in the original input towards the
  counterfactual input until the decision boundary is found. During the search
  for a closer counterfactual, the algorithm manipulates different subsets of
  features, while keeping other features frozen. Thus, the algorithm tries to
  find the closest counterfactual that differs only in a single feature value,
  two feature values, etc., up to the selected "Maximum number of columns to
  change" configuration parameter. Only scalar and categorical features are
  changed during the search. The features of other types are always assigned the
  values of the original input.
  
  The implementation supports both classification and regression models. In case
  of a regression model, the "Regression threshold" parameter sets a decision
  boundary between the 'true' and 'false' values.
  
  The generator weakly guarantees that the result set of counterfactuals
  is minimal, i.e. for every counterfactual in the set, there exist no other
  counterfactual that differs in the same or smaller set of features and is
  closer to the original input.
class_docstr_tok: ["The","Minimal","Targeted","Counterfactual","generator","for","tabular","data",".","This","generator","looks","for","counterfactuals","that","are","close","to","the","original","input","without","using","gradients",".","First",",","the","generator","finds","counterfactual","examples","from","the","dataset",".","Then",",","it","changes","features","in","the","original","input","towards","the","counterfactual","input","until","the","decision","boundary","is","found",".","During","the","search","for","a","closer","counterfactual",",","the","algorithm","manipulates","different","subsets","of","features",",","while","keeping","other","features","frozen",".","Thus",",","the","algorithm","tries","to","find","the","closest","counterfactual","that","differs","only","in","a","single","feature","value",",","two","feature","values",",","etc.",",","up","to","the","selected","``","Maximum","number","of","columns","to","change","''","configuration","parameter",".","Only","scalar","and","categorical","features","are","changed","during","the","search",".","The","features","of","other","types","are","always","assigned","the","values","of","the","original","input",".","The","implementation","supports","both","classification","and","regression","models",".","In","case","of","a","regression","model",",","the","``","Regression","threshold","''","parameter","sets","a","decision","boundary","between","the","'true","'","and","'false","'","values",".","The","generator","weakly","guarantees","that","the","result","set","of","counterfactuals","is","minimal",",","i.e",".","for","every","counterfactual","in","the","set",",","there","exist","no","other","counterfactual","that","differs","in","the","same","or","smaller","set","of","features","and","is","closer","to","the","original","input","."]
code: def _add_if_not_strictly_worse(
      self,
      example: JsonDict,
      other_examples: list[JsonDict],
      ref_example: JsonDict,
      dataset: lit_dataset.Dataset,
      dataset_name: str,
      model: lit_model.Model,
  ):
      for other_example in other_examples:
          is_worse = self._is_strictly_worse(
              example_1=example,
              example_2=other_example,
              ref_example=ref_example,
              dataset=dataset,
              dataset_name=dataset_name,
              model=model,
          )
          if is_worse:
              return
      other_examples.append(example)
  
imports: import collections
  from typing import Any, cast, Optional
  from absl import logging
  from lit_nlp.api import components
  from lit_nlp.api import dataset
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.components import cf_utils
  from lit_nlp.lib import caching
  from lit_nlp.lib import utils
  import numpy
label_desc: Use image node_id 19 for calling the TabularMTC obj's underlying member method code with example usage: obj._add_if_not_strictly_worse(example, other_examples, ref_example, dataset, dataset_name, model) without return types