def __init__(self, is_chief, num_ps_replicas, ensemble_handle, center_bias, examples_per_layer, learner_config, features, logits_dimension, loss_reduction=losses.Reduction.SUM_OVER_NONZERO_WEIGHTS, feature_columns=None, use_core_columns=False, output_leaf_index=False, output_leaf_index_modes=None, num_quantiles=100):
    "Construct a new GradientBoostedDecisionTreeModel function.\n\n    Args:\n      is_chief: Whether to build the chief graph.\n      num_ps_replicas: Number of parameter server replicas, can be 0.\n      ensemble_handle: A handle to the ensemble variable.\n      center_bias: Whether to center the bias before growing trees.\n      examples_per_layer: Number of examples to accumulate before growing a tree\n        layer. It can also be a function that computes the number of examples\n        based on the depth of the layer that's being built.\n      learner_config: A learner config.\n      features: `dict` of `Tensor` objects.\n      logits_dimension: An int, the dimension of logits.\n      loss_reduction: Either `SUM_OVER_NONZERO_WEIGHTS` (mean) or `SUM`.\n      feature_columns: A list of feature columns.\n      use_core_columns: A boolean specifying whether core feature columns are\n        used.\n      output_leaf_index: A boolean variable indicating whether to output leaf\n        index into predictions dictionary.\n      output_leaf_index_modes: A list of modes from (TRAIN, EVAL, INFER) which\n        dictates when leaf indices will be outputted. By default, leaf indices\n        are only outputted in INFER mode.\n      num_quantiles: Number of quantiles to build for numeric feature values.\n\n    Raises:\n      ValueError: if inputs are not valid.\n    "
    if (ensemble_handle is None):
        raise ValueError('ensemble_handle must be specified.')
    if (learner_config is None):
        raise ValueError('learner_config must be specified.')
    if (learner_config.num_classes < 2):
        raise ValueError('Number of classes must be >=2')
    self._logits_dimension = logits_dimension
    self._is_chief = is_chief
    self._num_ps_replicas = num_ps_replicas
    self._ensemble_handle = ensemble_handle
    self._center_bias = center_bias
    self._examples_per_layer = examples_per_layer
    if ((loss_reduction != losses.Reduction.SUM) and (loss_reduction != losses.Reduction.SUM_OVER_NONZERO_WEIGHTS)):
        raise ValueError(('Invalid loss reduction is provided: %s.' % loss_reduction))
    self._loss_reduction = loss_reduction
    if (learner_config.multi_class_strategy == learner_pb2.LearnerConfig.MULTI_CLASS_STRATEGY_UNSPECIFIED):
        if (logits_dimension == 1):
            learner_config.multi_class_strategy = learner_pb2.LearnerConfig.TREE_PER_CLASS
        else:
            learner_config.multi_class_strategy = learner_pb2.LearnerConfig.DIAGONAL_HESSIAN
    if ((logits_dimension == 1) or (learner_config.multi_class_strategy == learner_pb2.LearnerConfig.TREE_PER_CLASS)):
        self._gradient_shape = tensor_shape.scalar()
        self._hessian_shape = tensor_shape.scalar()
    else:
        if center_bias:
            raise ValueError('Center bias should be False for multiclass.')
        self._gradient_shape = tensor_shape.TensorShape([logits_dimension])
        if (learner_config.multi_class_strategy == learner_pb2.LearnerConfig.FULL_HESSIAN):
            self._hessian_shape = tensor_shape.TensorShape([logits_dimension, logits_dimension])
        else:
            self._hessian_shape = tensor_shape.TensorShape([logits_dimension])
    if (learner_config.growing_mode == learner_pb2.LearnerConfig.GROWING_MODE_UNSPECIFIED):
        learner_config.growing_mode = learner_pb2.LearnerConfig.LAYER_BY_LAYER
    if (learner_config.pruning_mode == learner_pb2.LearnerConfig.PRUNING_MODE_UNSPECIFIED):
        learner_config.pruning_mode = learner_pb2.LearnerConfig.POST_PRUNE
    if (learner_config.constraints.max_tree_depth == 0):
        learner_config.constraints.max_tree_depth = 6
    tuner = learner_config.learning_rate_tuner.WhichOneof('tuner')
    if (not tuner):
        learner_config.learning_rate_tuner.fixed.learning_rate = 0.1
    self._learner_config = learner_config
    self._feature_columns = feature_columns
    self._learner_config_serialized = learner_config.SerializeToString()
    self._num_quantiles = num_quantiles
    self._max_tree_depth = variables.VariableV1(initial_value=self._learner_config.constraints.max_tree_depth)
    self._attempted_trees = variables.VariableV1(initial_value=array_ops.zeros([], dtypes.int64), trainable=False, name='attempted_trees')
    self._finalized_trees = variables.VariableV1(initial_value=array_ops.zeros([], dtypes.int64), trainable=False, name='finalized_trees')
    if (not features):
        raise ValueError('Features dictionary must be specified.')
    (fc_names, dense_floats, sparse_float_indices, sparse_float_values, sparse_float_shapes, sparse_int_indices, sparse_int_values, sparse_int_shapes) = extract_features(features, self._feature_columns, use_core_columns)
    logging.info(('Active Feature Columns: ' + str(fc_names)))
    logging.info(('Learner config: ' + str(learner_config)))
    self._fc_names = fc_names
    self._dense_floats = dense_floats
    self._sparse_float_indices = sparse_float_indices
    self._sparse_float_values = sparse_float_values
    self._sparse_float_shapes = sparse_float_shapes
    self._sparse_int_indices = sparse_int_indices
    self._sparse_int_values = sparse_int_values
    self._sparse_int_shapes = sparse_int_shapes
    self._reduce_dim = ((self._learner_config.multi_class_strategy == learner_pb2.LearnerConfig.TREE_PER_CLASS) and (learner_config.num_classes == 2))
    if (output_leaf_index_modes is None):
        output_leaf_index_modes = [learn.ModeKeys.INFER]
    elif (not all(((mode in (learn.ModeKeys.TRAIN, learn.ModeKeys.EVAL, learn.ModeKeys.INFER)) for mode in output_leaf_index_modes))):
        raise ValueError('output_leaf_index_modes should only contain ModeKeys.')
    self._output_leaf_index = output_leaf_index
    self._output_leaf_index_modes = output_leaf_index_modes
Construct a new GradientBoostedDecisionTreeModel function.

Args:
  is_chief: Whether to build the chief graph.
  num_ps_replicas: Number of parameter server replicas, can be 0.
  ensemble_handle: A handle to the ensemble variable.
  center_bias: Whether to center the bias before growing trees.
  examples_per_layer: Number of examples to accumulate before growing a tree
    layer. It can also be a function that computes the number of examples
    based on the depth of the layer that's being built.
  learner_config: A learner config.
  features: `dict` of `Tensor` objects.
  logits_dimension: An int, the dimension of logits.
  loss_reduction: Either `SUM_OVER_NONZERO_WEIGHTS` (mean) or `SUM`.
  feature_columns: A list of feature columns.
  use_core_columns: A boolean specifying whether core feature columns are
    used.
  output_leaf_index: A boolean variable indicating whether to output leaf
    index into predictions dictionary.
  output_leaf_index_modes: A list of modes from (TRAIN, EVAL, INFER) which
    dictates when leaf indices will be outputted. By default, leaf indices
    are only outputted in INFER mode.
  num_quantiles: Number of quantiles to build for numeric feature values.

Raises:
  ValueError: if inputs are not valid.
def __init__(self, is_chief, num_ps_replicas, ensemble_handle, center_bias, examples_per_layer, learner_config, features, logits_dimension, loss_reduction=losses.Reduction.SUM_OVER_NONZERO_WEIGHTS, feature_columns=None, use_core_columns=False, output_leaf_index=False, output_leaf_index_modes=None, num_quantiles=100):
    "Construct a new GradientBoostedDecisionTreeModel function.\n\n    Args:\n      is_chief: Whether to build the chief graph.\n      num_ps_replicas: Number of parameter server replicas, can be 0.\n      ensemble_handle: A handle to the ensemble variable.\n      center_bias: Whether to center the bias before growing trees.\n      examples_per_layer: Number of examples to accumulate before growing a tree\n        layer. It can also be a function that computes the number of examples\n        based on the depth of the layer that's being built.\n      learner_config: A learner config.\n      features: `dict` of `Tensor` objects.\n      logits_dimension: An int, the dimension of logits.\n      loss_reduction: Either `SUM_OVER_NONZERO_WEIGHTS` (mean) or `SUM`.\n      feature_columns: A list of feature columns.\n      use_core_columns: A boolean specifying whether core feature columns are\n        used.\n      output_leaf_index: A boolean variable indicating whether to output leaf\n        index into predictions dictionary.\n      output_leaf_index_modes: A list of modes from (TRAIN, EVAL, INFER) which\n        dictates when leaf indices will be outputted. By default, leaf indices\n        are only outputted in INFER mode.\n      num_quantiles: Number of quantiles to build for numeric feature values.\n\n    Raises:\n      ValueError: if inputs are not valid.\n    "
    if (ensemble_handle is None):
        raise ValueError('ensemble_handle must be specified.')
    if (learner_config is None):
        raise ValueError('learner_config must be specified.')
    if (learner_config.num_classes < 2):
        raise ValueError('Number of classes must be >=2')
    self._logits_dimension = logits_dimension
    self._is_chief = is_chief
    self._num_ps_replicas = num_ps_replicas
    self._ensemble_handle = ensemble_handle
    self._center_bias = center_bias
    self._examples_per_layer = examples_per_layer
    if ((loss_reduction != losses.Reduction.SUM) and (loss_reduction != losses.Reduction.SUM_OVER_NONZERO_WEIGHTS)):
        raise ValueError(('Invalid loss reduction is provided: %s.' % loss_reduction))
    self._loss_reduction = loss_reduction
    if (learner_config.multi_class_strategy == learner_pb2.LearnerConfig.MULTI_CLASS_STRATEGY_UNSPECIFIED):
        if (logits_dimension == 1):
            learner_config.multi_class_strategy = learner_pb2.LearnerConfig.TREE_PER_CLASS
        else:
            learner_config.multi_class_strategy = learner_pb2.LearnerConfig.DIAGONAL_HESSIAN
    if ((logits_dimension == 1) or (learner_config.multi_class_strategy == learner_pb2.LearnerConfig.TREE_PER_CLASS)):
        self._gradient_shape = tensor_shape.scalar()
        self._hessian_shape = tensor_shape.scalar()
    else:
        if center_bias:
            raise ValueError('Center bias should be False for multiclass.')
        self._gradient_shape = tensor_shape.TensorShape([logits_dimension])
        if (learner_config.multi_class_strategy == learner_pb2.LearnerConfig.FULL_HESSIAN):
            self._hessian_shape = tensor_shape.TensorShape([logits_dimension, logits_dimension])
        else:
            self._hessian_shape = tensor_shape.TensorShape([logits_dimension])
    if (learner_config.growing_mode == learner_pb2.LearnerConfig.GROWING_MODE_UNSPECIFIED):
        learner_config.growing_mode = learner_pb2.LearnerConfig.LAYER_BY_LAYER
    if (learner_config.pruning_mode == learner_pb2.LearnerConfig.PRUNING_MODE_UNSPECIFIED):
        learner_config.pruning_mode = learner_pb2.LearnerConfig.POST_PRUNE
    if (learner_config.constraints.max_tree_depth == 0):
        learner_config.constraints.max_tree_depth = 6
    tuner = learner_config.learning_rate_tuner.WhichOneof('tuner')
    if (not tuner):
        learner_config.learning_rate_tuner.fixed.learning_rate = 0.1
    self._learner_config = learner_config
    self._feature_columns = feature_columns
    self._learner_config_serialized = learner_config.SerializeToString()
    self._num_quantiles = num_quantiles
    self._max_tree_depth = variables.VariableV1(initial_value=self._learner_config.constraints.max_tree_depth)
    self._attempted_trees = variables.VariableV1(initial_value=array_ops.zeros([], dtypes.int64), trainable=False, name='attempted_trees')
    self._finalized_trees = variables.VariableV1(initial_value=array_ops.zeros([], dtypes.int64), trainable=False, name='finalized_trees')
    if (not features):
        raise ValueError('Features dictionary must be specified.')
    (fc_names, dense_floats, sparse_float_indices, sparse_float_values, sparse_float_shapes, sparse_int_indices, sparse_int_values, sparse_int_shapes) = extract_features(features, self._feature_columns, use_core_columns)
    logging.info(('Active Feature Columns: ' + str(fc_names)))
    logging.info(('Learner config: ' + str(learner_config)))
    self._fc_names = fc_names
    self._dense_floats = dense_floats
    self._sparse_float_indices = sparse_float_indices
    self._sparse_float_values = sparse_float_values
    self._sparse_float_shapes = sparse_float_shapes
    self._sparse_int_indices = sparse_int_indices
    self._sparse_int_values = sparse_int_values
    self._sparse_int_shapes = sparse_int_shapes
    self._reduce_dim = ((self._learner_config.multi_class_strategy == learner_pb2.LearnerConfig.TREE_PER_CLASS) and (learner_config.num_classes == 2))
    if (output_leaf_index_modes is None):
        output_leaf_index_modes = [learn.ModeKeys.INFER]
    elif (not all(((mode in (learn.ModeKeys.TRAIN, learn.ModeKeys.EVAL, learn.ModeKeys.INFER)) for mode in output_leaf_index_modes))):
        raise ValueError('output_leaf_index_modes should only contain ModeKeys.')
    self._output_leaf_index = output_leaf_index
    self._output_leaf_index_modes = output_leaf_index_modes