class_docstr: [WIP] ForesEstimator
      
class_docstr_tok: ["[","WIP","]","ForesEstimator"]
docstr: fit.
  
  Build a forest of trees from the data provided.
  
  Arguments:
      X: `Tensor` or `Tensor list`. The input data. It must be a list of
          `Tensor` in case of multiple inputs.
      Y: `Tensor`. The labels/targets tensor.
      batch_size: `int`. The batch size.
      shuffle: ` bool`. If True, data are shuffled.
      display_step: `int`. The step to display training information.
      n_jobs: `int`. The number of jobs to use for the computation.
      max_steps: `int`. Maximum number of optimization steps to run.
docstr_tok: ["fit",".","Build","a","forest","of","trees","from","the","data","provided",".","Arguments",":","X",":","`","Tensor","`","or","`","Tensor","list","`",".","The","input","data",".","It","must","be","a","list","of","`","Tensor","`","in","case","of","multiple","inputs",".","Y",":","`","Tensor","`",".","The","labels\/targets","tensor",".","batch_size",":","`","int","`",".","The","batch","size",".","shuffle",":","`","bool","`",".","If","True",",","data","are","shuffled",".","display_step",":","`","int","`",".","The","step","to","display","training","information",".","n_jobs",":","`","int","`",".","The","number","of","jobs","to","use","for","the","computation",".","max_steps",":","`","int","`",".","Maximum","number","of","optimization","steps","to","run","."]
code: def fit(
      self,
      X,
      Y,
      batch_size=1024,
      shuffle=True,
      display_step=500,
      n_jobs=1,
      max_steps=None,
  ):
      """fit.
  
      Build a forest of trees from the data provided.
  
      Arguments:
          X: `Tensor` or `Tensor list`. The input data. It must be a list of
              `Tensor` in case of multiple inputs.
          Y: `Tensor`. The labels/targets tensor.
          batch_size: `int`. The batch size.
          shuffle: ` bool`. If True, data are shuffled.
          display_step: `int`. The step to display training information.
          n_jobs: `int`. The number of jobs to use for the computation.
          max_steps: `int`. Maximum number of optimization steps to run.
  
      """
  
      with self.graph.as_default():
          # Verify data dimension
          validate_dim(X, max_dim=2, min_dim=2, var_name="X")
          if not self.regression:
              validate_dim(Y, max_dim=1, min_dim=1, var_name="Y")
          else:
              validate_dim(Y, min_dim=1, var_name="Y")
  
          # Get data size
          num_samples = get_num_sample(X)
  
          # Build Tree Graph
          self._build_estimator(X, Y)
  
          # Generate Data Tensors. Be aware that every fit with different
          # data will re-create a data tensor.
          if (
              self._train.get_params("X") != hex(id(X))
              or self._train.get_params("Y") != hex(id(Y))
              or self._train.get_params("batch_size") != batch_size
              or not self._train.is_ready
          ):
              X, Y, cr = generate_data_tensor(
                  X,
                  Y,
                  batch_size=batch_size,
                  shuffle=shuffle,
                  num_threads=8,
              )
              X, _, spec = data_ops.ParseDataTensorOrDict(X)
              Y = data_ops.ParseLabelTensorOrDict(Y)
  
              self._train_op = tf.group(
                  self.forest_graph.training_graph(
                      X, Y, num_trainers=n_jobs
                  ),
                  state_ops.assign_add(self.global_step, 1),
              )
              self._loss_op = self.forest_graph.training_loss(X, Y)
              self._build_fit(X, Y, batch_size)
  
              # Start QueueRunners
              tf.train.start_queue_runners(sess=self.session)
              if cr:
                  cr.launch_threads(self.session)
  
              self._init_graph()
  
          gstep = self.global_step.eval(session=self.session)
  
          last_loss = []
          loss_val = None
          step = 0
  
          # Set step to -1 to exit training
          while True:
              # Monitor loss
              last_loss.append(loss_val)
              if len(last_loss) > 10:
                  last_loss.pop(0)
  
              start_time = time.time()
              if (step) % display_step == 0:
                  _, loss_val = self.session.run(
                      [self._train_op, self._loss_op]
                  )  # TODO: Add acc
              else:
                  _, loss_val = self.session.run(
                      [self._train_op, self._loss_op]
                  )
              duration = time.time() - start_time
  
              if (step) % display_step == 0:
                  examples_per_sec = batch_size / duration
                  sec_per_batch = duration
                  if self.metric:
                      format_str = (
                          "%s: step %d, loss = %.2f, acc = %.2f, "
                          "(%.1f examples/sec; %.3f sec/batch)"
                      )
                      print(
                          format_str
                          % (
                              datetime.now(),
                              step + gstep,
                              loss_val,
                              examples_per_sec,
                              sec_per_batch,
                          )
                      )
                  else:
                      format_str = (
                          "%s: step %d, loss = %.2f, "
                          "(%.1f examples/sec; %.3f sec/batch)"
                      )
                      print(
                          format_str
                          % (
                              datetime.now(),
                              step + gstep,
                              loss_val,
                              examples_per_sec,
                              sec_per_batch,
                          )
                      )
  
              step += 1
  
              # Automatic stop after ten flat loss
              if (
                  len(last_loss) == 10
                  and len(set(last_loss)) <= 1
                  and not max_steps
              ):
                  break
  
              # Max Steps stop
              if max_steps:
                  if step == max_steps:
                      break
  
          save_path = os.path.join(self.log_dir, "randomforest.ckpt")
          self.saver.save(
              sess=self.session,
              save_path=save_path,
              global_step=self.global_step,
          )
  
imports: from __future__ import division, print_function, absolute_import
  from datetime import datetime
  import os
  import math
  import numpy
  import time
  import tensorflow.compat.v1
  from tensorflow.contrib.tensor_forest.python import tensor_forest
  from tensorflow.contrib.tensor_forest.python.ops import data_ops
  from tensorflow.python.ops import state_ops, array_ops, math_ops
  from ...utils import validate_dim, read_tensor_in_checkpoint
  from ...data_utils import get_num_features, get_num_classes, get_num_sample
  from ...data_flow import generate_data_tensor
  from ..base import BaseEstimator
label_desc: Use image node_id 3 for calling the ForestEstimator obj's underlying member method code with example usage: obj.fit(X, Y, batch_size, shuffle, display_step, n_jobs, max_steps) without return types