docstr: predict.
  
  Predict the closest cluster.
  
  Arguments:
      X: `1-D Array` or `2-D Array` of shape (n_samples, n_features).
          The sample(s) to predict.
  
  Return:
      cluster_indices or (cluster_indices, distances).
docstr_tok: ["predict",".","Predict","the","closest","cluster",".","Arguments",":","X",":","`","1-D","Array","`","or","`","2-D","Array","`","of","shape","(","n_samples",",","n_features",")",".","The","sample","(","s",")","to","predict",".","Return",":","cluster_indices","or","(","cluster_indices",",","distances",")","."]
code: def predict(self, X, with_distances=False):
      """predict.
  
      Predict the closest cluster.
  
      Arguments:
          X: `1-D Array` or `2-D Array` of shape (n_samples, n_features).
              The sample(s) to predict.
  
      Return:
          cluster_indices or (cluster_indices, distances).
  
      """
  
      X, orig_ndim = prepare_X(
          X, 2, max_dim=2, min_dim=1, debug_msg="X"
      )
  
      with self.graph.as_default():
          # Build Tree Graph
          self._build_estimator()
          if not self._pred.is_ready:
              input = tf.placeholder(
                  tf.float32,
                  name="pred_input",
                  shape=[None, self.num_features],
              )
              output = c_ops.nearest_neighbors(
                  input, self._cluster_centers_vars, k=1
              )
              self._build_pred(input, output)
          indices, distances = self.session.run(
              self._pred.output_tensor,
              feed_dict={self._pred.input_tensor: X},
          )
          indices = indices[0]
          distances = distances[0]
          if orig_ndim == 1:
              indices = indices[0]
              distances = distances[0]
          if with_distances:
              return indices, distances
          return indices
  
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.factorization.python.ops import clustering_ops
  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, prepare_X
  from ...data_utils import get_num_features, get_num_sample
  from ...data_flow import generate_data_tensor
  from ...distances import euclidean, cosine
  from ..base import BaseEstimator
label_desc: Use image node_id 13 for calling the KMeansBase obj's underlying member method code with example usage: obj.predict(X, with_distances) and returns: indices, indices,  distances