class_docstr: Configuration builder for WitWidget settings.
docstr: Sets a second custom function for inference.
  
  If you wish to compare the results of two models in WIT, use this method
  to setup the details of the second model.
  
  Instead of using TF Serving to host a model for WIT to query, WIT can
  directly use a custom function as the model to query. In this case, the
  provided function should accept example protos and return:
    - For classification: A 2D list of numbers. The first dimension is for
      each example being predicted. The second dimension are the probabilities
      for each class ID in the prediction.
    - For regression: A 1D list of numbers, with a regression score for each
      example being predicted.
  
  Optionally, if attributions or other prediction-time information
  can be returned by the model with each prediction, then this method
  can return a dict with the key 'predictions' containing the predictions
  result list described above, and with the key 'attributions' containing
  a list of attributions for each example that was predicted.
  
  For each example, the attributions list should contain a dict mapping
  input feature names to attribution values for that feature on that example.
  The attribution value can be one of these things:
    - A single number representing the attribution for the entire feature
    - A list of numbers representing the attribution to each value in the
      feature for multivalent features - such as attributions to individual
      pixels in an image or numbers in a list of numbers.
    - A 2D list for sparse feature attribution. Index 0 contains a list of
      feature values that there are attribution scores for. Index 1 contains
      a list of attribution values for the corresponding feature values in
      the first list.
  
  This dict can contain any other keys, with their values being a list of
  prediction-time strings or numbers for each example being predicted. These
  values will be displayed in WIT as extra information for each example,
  usable in the same ways by WIT as normal input features (such as for
  creating plots and slicing performance data).
  
  Args:
    predict_fn: The custom python function which will be used for model
    inference.
  
  Returns:
    self, in order to enabled method chaining.
docstr_tok: ["Sets","a","second","custom","function","for","inference",".","If","you","wish","to","compare","the","results","of","two","models","in","WIT",",","use","this","method","to","setup","the","details","of","the","second","model",".","Instead","of","using","TF","Serving","to","host","a","model","for","WIT","to","query",",","WIT","can","directly","use","a","custom","function","as","the","model","to","query",".","In","this","case",",","the","provided","function","should","accept","example","protos","and","return",":","-","For","classification",":","A","2D","list","of","numbers",".","The","first","dimension","is","for","each","example","being","predicted",".","The","second","dimension","are","the","probabilities","for","each","class","ID","in","the","prediction",".","-","For","regression",":","A","1D","list","of","numbers",",","with","a","regression","score","for","each","example","being","predicted",".","Optionally",",","if","attributions","or","other","prediction-time","information","can","be","returned","by","the","model","with","each","prediction",",","then","this","method","can","return","a","dict","with","the","key","'predictions","'","containing","the","predictions","result","list","described","above",",","and","with","the","key","'attributions","'","containing","a","list","of","attributions","for","each","example","that","was","predicted",".","For","each","example",",","the","attributions","list","should","contain","a","dict","mapping","input","feature","names","to","attribution","values","for","that","feature","on","that","example",".","The","attribution","value","can","be","one","of","these","things",":","-","A","single","number","representing","the","attribution","for","the","entire","feature","-","A","list","of","numbers","representing","the","attribution","to","each","value","in","the","feature","for","multivalent","features","-","such","as","attributions","to","individual","pixels","in","an","image","or","numbers","in","a","list","of","numbers",".","-","A","2D","list","for","sparse","feature","attribution",".","Index","0","contains","a","list","of","feature","values","that","there","are","attribution","scores","for",".","Index","1","contains","a","list","of","attribution","values","for","the","corresponding","feature","values","in","the","first","list",".","This","dict","can","contain","any","other","keys",",","with","their","values","being","a","list","of","prediction-time","strings","or","numbers","for","each","example","being","predicted",".","These","values","will","be","displayed","in","WIT","as","extra","information","for","each","example",",","usable","in","the","same","ways","by","WIT","as","normal","input","features","(","such","as","for","creating","plots","and","slicing","performance","data",")",".","Args",":","predict_fn",":","The","custom","python","function","which","will","be","used","for","model","inference",".","Returns",":","self",",","in","order","to","enabled","method","chaining","."]
code: def set_compare_custom_predict_fn(self, predict_fn):
      """Sets a second custom function for inference.
  
      If you wish to compare the results of two models in WIT, use this method
      to setup the details of the second model.
  
      Instead of using TF Serving to host a model for WIT to query, WIT can
      directly use a custom function as the model to query. In this case, the
      provided function should accept example protos and return:
        - For classification: A 2D list of numbers. The first dimension is for
          each example being predicted. The second dimension are the probabilities
          for each class ID in the prediction.
        - For regression: A 1D list of numbers, with a regression score for each
          example being predicted.
  
      Optionally, if attributions or other prediction-time information
      can be returned by the model with each prediction, then this method
      can return a dict with the key 'predictions' containing the predictions
      result list described above, and with the key 'attributions' containing
      a list of attributions for each example that was predicted.
  
      For each example, the attributions list should contain a dict mapping
      input feature names to attribution values for that feature on that example.
      The attribution value can be one of these things:
        - A single number representing the attribution for the entire feature
        - A list of numbers representing the attribution to each value in the
          feature for multivalent features - such as attributions to individual
          pixels in an image or numbers in a list of numbers.
        - A 2D list for sparse feature attribution. Index 0 contains a list of
          feature values that there are attribution scores for. Index 1 contains
          a list of attribution values for the corresponding feature values in
          the first list.
  
      This dict can contain any other keys, with their values being a list of
      prediction-time strings or numbers for each example being predicted. These
      values will be displayed in WIT as extra information for each example,
      usable in the same ways by WIT as normal input features (such as for
      creating plots and slicing performance data).
  
      Args:
        predict_fn: The custom python function which will be used for model
        inference.
  
      Returns:
        self, in order to enabled method chaining.
      """
      # If estimator is set, remove it before setting predict_fn
      self.delete("compare_estimator_and_spec")
  
      self.store("compare_custom_predict_fn", predict_fn)
      self.set_compare_inference_address("custom_predict_fn")
      # If no model name has been set, give a default
      if not self.has_compare_model_name():
          self.set_compare_model_name("2")
      return self
  
imports: import sys
  import tensorflow
label_desc: Use image node_id 26 for calling the WitConfigBuilder obj's underlying member method code with example usage: obj.set_compare_custom_predict_fn(predict_fn) and returns: self