class_docstr: Creates histogram from labels, predictions, and example weights.
class_docstr_tok: ["Creates","histogram","from","labels",",","predictions",",","and","example","weights","."]
docstr: Returns bucket index given prediction value. Values are truncated.
docstr_tok: ["Returns","bucket","index","given","prediction","value",".","Values","are","truncated","."]
code: def _bucket_index(self, prediction: float) -> int:
      """Returns bucket index given prediction value. Values are truncated."""
      bucket_index = (
          (prediction - self._left) / self._range * self._num_buckets
      ) + 1
      if bucket_index < 0:
          return 0
      if bucket_index >= self._num_buckets + 1:
          return self._num_buckets + 1
      return int(bucket_index)
  
file_path: model-analysis/tensorflow_model_analysis/metrics/calibration_histogram.py
imports: import dataclasses
  import operator
  from typing import Dict, Iterable, List, Optional
  import apache_beam
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 2 for calling the _CalibrationHistogramCombiner obj's underlying member method code with example usage: obj._bucket_index(prediction) and returns: int, int, unknown