class_docstr: TCAV object: runs TCAV for one target and a set of concepts.
  The static methods (get_direction_dir_sign, compute_tcav_score,
  get_directional_dir) invole getting directional derivatives and calculating
  TCAV scores. These are static because they might be useful independently,
  for instance, if you are developing a new interpretability method using
  CAVs.
  See https://arxiv.org/abs/1711.11279
docstr: Compute TCAV score.
  
  Args:
    mymodel: a model class instance
    target_class: one target class
    concept: one concept
    cav: an instance of cav
    class_acts: activations of the examples in the target class where
      examples[i] corresponds to class_acts[i]
    examples: an array of examples of the target class where examples[i]
      corresponds to class_acts[i]
    run_parallel: run this parallel fashion
    num_workers: number of workers if we run in parallel.
  
  Returns:
      TCAV score (i.e., ratio of pictures that returns negative dot product
      wrt loss).
docstr_tok: ["Compute","TCAV","score",".","Args",":","mymodel",":","a","model","class","instance","target_class",":","one","target","class","concept",":","one","concept","cav",":","an","instance","of","cav","class_acts",":","activations","of","the","examples","in","the","target","class","where","examples","[","i","]","corresponds","to","class_acts","[","i","]","examples",":","an","array","of","examples","of","the","target","class","where","examples","[","i","]","corresponds","to","class_acts","[","i","]","run_parallel",":","run","this","parallel","fashion","num_workers",":","number","of","workers","if","we","run","in","parallel",".","Returns",":","TCAV","score","(","i.e.",",","ratio","of","pictures","that","returns","negative","dot","product","wrt","loss",")","."]
code: def compute_tcav_score(
      mymodel,
      target_class,
      concept,
      cav,
      class_acts,
      examples,
      run_parallel=True,
      num_workers=20,
  ):
      """Compute TCAV score.
  
      Args:
        mymodel: a model class instance
        target_class: one target class
        concept: one concept
        cav: an instance of cav
        class_acts: activations of the examples in the target class where
          examples[i] corresponds to class_acts[i]
        examples: an array of examples of the target class where examples[i]
          corresponds to class_acts[i]
        run_parallel: run this parallel fashion
        num_workers: number of workers if we run in parallel.
  
      Returns:
          TCAV score (i.e., ratio of pictures that returns negative dot product
          wrt loss).
      """
      count = 0
      class_id = mymodel.label_to_id(target_class)
      if run_parallel:
          pool = multiprocessing.Pool(num_workers)
          directions = pool.map(
              lambda i: TCAV.get_direction_dir_sign(
                  mymodel,
                  np.expand_dims(class_acts[i], 0),
                  cav,
                  concept,
                  class_id,
                  examples[i],
              ),
              range(len(class_acts)),
          )
          pool.close()
          return sum(directions) / float(len(class_acts))
      else:
          for i in range(len(class_acts)):
              act = np.expand_dims(class_acts[i], 0)
              example = examples[i]
              if TCAV.get_direction_dir_sign(
                  mymodel, act, cav, concept, class_id, example
              ):
                  count += 1
          return float(count) / float(len(class_acts))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from multiprocessing import dummy
  from six.moves import range
  from tcav.cav import CAV
  from tcav.cav import get_or_train_cav
  from tcav import run_params
  from tcav import utils
  import numpy
  import time
  import tensorflow
label_desc: Use image node_id 2 for calling the TCAV obj's underlying member method code with example usage: obj.compute_tcav_score(mymodel, target_class, concept, cav, class_acts, examples, run_parallel, num_workers) and returns: unknown, unknown