class_docstr: Light-weight class for holding UI state.
  
  Attributes:
    x_min: The minimum value to use to generate mutants for the feature
      (as specified the user on the UI).
    x_max: The maximum value to use to generate mutants for the feature
      (as specified the user on the UI).
    examples: A list of examples to scan in order to generate statistics for
      mutants.
    num_mutants: Int number of mutants to generate per chart.
    feature_index_pattern: String that specifies a restricted set of indices
      of the feature to generate mutants for (useful for features that is a
      long repeated field. See `convert_pattern_to_indices` for more details.
class_docstr_tok: ["Light-weight","class","for","holding","UI","state",".","Attributes",":","x_min",":","The","minimum","value","to","use","to","generate","mutants","for","the","feature","(","as","specified","the","user","on","the","UI",")",".","x_max",":","The","maximum","value","to","use","to","generate","mutants","for","the","feature","(","as","specified","the","user","on","the","UI",")",".","examples",":","A","list","of","examples","to","scan","in","order","to","generate","statistics","for","mutants",".","num_mutants",":","Int","number","of","mutants","to","generate","per","chart",".","feature_index_pattern",":","String","that","specifies","a","restricted","set","of","indices","of","the","feature","to","generate","mutants","for","(","useful","for","features","that","is","a","long","repeated","field",".","See","`","convert_pattern_to_indices","`","for","more","details","."]
docstr: Inits VizParams may raise InvalidUserInputError for bad user inputs.
docstr_tok: ["Inits","VizParams","may","raise","InvalidUserInputError","for","bad","user","inputs","."]
code: def __init__(
      self, x_min, x_max, examples, num_mutants, feature_index_pattern
  ):
      """Inits VizParams may raise InvalidUserInputError for bad user inputs."""
  
      def to_float_or_none(x):
          try:
              return float(x)
          except (ValueError, TypeError):
              return None
  
      def to_int(x):
          try:
              return int(x)
          except (ValueError, TypeError) as e:
              raise common_utils.InvalidUserInputError(e)
  
      def convert_pattern_to_indices(pattern):
          """Converts a printer-page-style pattern and returns a list of indices.
  
          Args:
            pattern: A printer-page-style pattern with only numeric characters,
              commas, dashes, and optionally spaces.
  
          For example, a pattern of '0,2,4-6' would yield [0, 2, 4, 5, 6].
  
          Returns:
            A list of indices represented by the pattern.
          """
          pieces = [token.strip() for token in pattern.split(",")]
          indices = []
          for piece in pieces:
              if "-" in piece:
                  lower, upper = [
                      int(x.strip()) for x in piece.split("-", 1)
                  ]
                  indices.extend(range(lower, upper + 1))
              else:
                  indices.append(int(piece.strip()))
          return sorted(indices)
  
      self.x_min = to_float_or_none(x_min)
      self.x_max = to_float_or_none(x_max)
      self.examples = examples
      self.num_mutants = to_int(num_mutants)
  
      # By default, there are no specific user-requested feature indices.
      self.feature_indices = []
      if feature_index_pattern:
          try:
              self.feature_indices = convert_pattern_to_indices(
                  feature_index_pattern
              )
          except ValueError as e:
              # If the user-requested range is invalid, use the default range.
              pass
  
imports: from __future__ import division
  from __future__ import print_function
  import collections
  import copy
  import json
  import math
  from absl import logging
  import numpy
  import tensorflow
  from google.protobuf import json_format
  from six import binary_type, string_types, integer_types
  from six import iteritems
  from six.moves import zip
  from inspect import signature
  from utils import common_utils
  from utils import platform_utils
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import inference_pb2
  from tensorflow_serving.apis import regression_pb2
label_desc: Use image node_id 1 to create a new VizParams object from inherited base classes: object with example: obj = VizParams(x_min, x_max, examples, num_mutants, feature_index_pattern)