class_docstr: Evaluate metrics for y_true and y_pred.
class_docstr_tok: ["Evaluate","metrics","for","y_true","and","y_pred","."]
docstr: `Evaluator.plot` function helps users to visualize their forecasting result.
  
  :param y: predict result, a 3-dim numpy ndarray with shape represented as
         (batch_size, predict_length, output_feature_dim).
  :param std: standard deviation, a 3-dim numpy ndarray with shape represented
         as (batch_size, predict_length, output_feature_dim). Same shape as `y`.
  :param ground_truth: ground truth, a 3-dim numpy ndarray with shape represented as
         (batch_size, predict_length, output_feature_dim). Same shape as `y`.
  :param x: input numpy array, a 3-dim numpy ndarray with shape represented
         as (batch_size, lookback_length, input_feature_dim).
  :param feature_index: int, the feature index (along last dim) to plot.
         Default to the first feature.
  :param instance_index: int/tuple/list, the instance index to show. Default to None
         which represents random number.
  :param layout: a 2-dim tuple, indicate the row_num and col_num to plot.
  :param prediction_internval: a float, indicates the confidence percentile. Default to
         0.95 refer to 95% confidence. This only effective when `std` is not None.
  :param figsize: figure size to be inputed to pyplot. Default to (16,16).
  :param output_file: a path, indicates the save path of the output plot. Default to
         None, indicates no output file is needed.
  :param **kwargs: other paramters will be passed to matplotlib.pyplot.
docstr_tok: ["`","Evaluator.plot","`","function","helps","users","to","visualize","their","forecasting","result",".",":","param","y",":","predict","result",",","a","3-dim","numpy","ndarray","with","shape","represented","as","(","batch_size",",","predict_length",",","output_feature_dim",")",".",":","param","std",":","standard","deviation",",","a","3-dim","numpy","ndarray","with","shape","represented","as","(","batch_size",",","predict_length",",","output_feature_dim",")",".","Same","shape","as","`","y","`",".",":","param","ground_truth",":","ground","truth",",","a","3-dim","numpy","ndarray","with","shape","represented","as","(","batch_size",",","predict_length",",","output_feature_dim",")",".","Same","shape","as","`","y","`",".",":","param","x",":","input","numpy","array",",","a","3-dim","numpy","ndarray","with","shape","represented","as","(","batch_size",",","lookback_length",",","input_feature_dim",")",".",":","param","feature_index",":","int",",","the","feature","index","(","along","last","dim",")","to","plot",".","Default","to","the","first","feature",".",":","param","instance_index",":","int\/tuple\/list",",","the","instance","index","to","show",".","Default","to","None","which","represents","random","number",".",":","param","layout",":","a","2-dim","tuple",",","indicate","the","row_num","and","col_num","to","plot",".",":","param","prediction_internval",":","a","float",",","indicates","the","confidence","percentile",".","Default","to","0.95","refer","to","95","%","confidence",".","This","only","effective","when","`","std","`","is","not","None",".",":","param","figsize",":","figure","size","to","be","inputed","to","pyplot",".","Default","to","(","16,16",")",".",":","param","output_file",":","a","path",",","indicates","the","save","path","of","the","output","plot",".","Default","to","None",",","indicates","no","output","file","is","needed",".",":","param","*","*","kwargs",":","other","paramters","will","be","passed","to","matplotlib.pyplot","."]
code: def plot(
      y,
      std=None,
      ground_truth=None,
      x=None,
      feature_index=0,
      instance_index=None,
      layout=(1, 1),
      prediction_interval=0.95,
      figsize=(16, 16),
      output_file=None,
      **kwargs,
  ):
      """
      `Evaluator.plot` function helps users to visualize their forecasting result.
  
      :param y: predict result, a 3-dim numpy ndarray with shape represented as
             (batch_size, predict_length, output_feature_dim).
      :param std: standard deviation, a 3-dim numpy ndarray with shape represented
             as (batch_size, predict_length, output_feature_dim). Same shape as `y`.
      :param ground_truth: ground truth, a 3-dim numpy ndarray with shape represented as
             (batch_size, predict_length, output_feature_dim). Same shape as `y`.
      :param x: input numpy array, a 3-dim numpy ndarray with shape represented
             as (batch_size, lookback_length, input_feature_dim).
      :param feature_index: int, the feature index (along last dim) to plot.
             Default to the first feature.
      :param instance_index: int/tuple/list, the instance index to show. Default to None
             which represents random number.
      :param layout: a 2-dim tuple, indicate the row_num and col_num to plot.
      :param prediction_internval: a float, indicates the confidence percentile. Default to
             0.95 refer to 95% confidence. This only effective when `std` is not None.
      :param figsize: figure size to be inputed to pyplot. Default to (16,16).
      :param output_file: a path, indicates the save path of the output plot. Default to
             None, indicates no output file is needed.
      :param **kwargs: other paramters will be passed to matplotlib.pyplot.
      """
      try:
          import matplotlib.pyplot as plt
      except ImportError:
          invalidInputError(
              False,
              "To enable visualization, you need to install matplotlib by:\n"
              "\t\t pip install matplotlib\n",
          )
  
      # shape check
      if std is not None:
          _check_shape(y, std, "y", "std")
      if ground_truth is not None:
          _check_shape(y, ground_truth, "y", "ground_truth")
      invalidInputError(
          len(layout) == 2,
          f"len of `layout` should be 2 while get {len(layout)}",
      )
  
      batch_num = y.shape[0]
      horizon = y.shape[1]
      lookback = 0 if x is None else x.shape[1]
      row_num = 1 if layout is None else layout[0]
      col_num = 1 if layout is None else layout[1]
  
      y_index = list(range(lookback, horizon + lookback))
      x_index = list(range(0, lookback))
      iter_num = 1
      instance_index_iter = (
          iter(instance_index) if instance_index is not None else None
      )
  
      plt.figure(figsize=figsize, **kwargs)
  
      for row_iter in range(1, row_num + 1):
          for col_iter in range(1, col_num + 1):
              # generate the index
              if instance_index_iter is None:
                  instance_index = random.randint(0, y.shape[0] - 1)
              else:
                  try:
                      instance_index = next(instance_index_iter)
                  except e:
                      # nothing to plot, skip following grids
                      continue
              ax = plt.subplot(row_num, col_num, iter_num)
              ax.plot(
                  y_index,
                  y[instance_index, :, feature_index],
                  color="royalblue",
              )
              if ground_truth is not None:
                  ax.plot(
                      y_index,
                      ground_truth[instance_index, :, feature_index],
                      color="limegreen",
                  )
              if x is not None:
                  ax.plot(
                      x_index,
                      x[instance_index, :, feature_index],
                      color="black",
                  )
                  ax.plot(
                      [x_index[-1], y_index[0]],
                      np.array(
                          [
                              x[instance_index, -1, feature_index],
                              y[instance_index, 0, feature_index],
                          ]
                      ),
                      color="royalblue",
                  )
                  if ground_truth is not None:
                      ax.plot(
                          [x_index[-1], y_index[0]],
                          np.array(
                              [
                                  x[instance_index, -1, feature_index],
                                  ground_truth[
                                      instance_index, 0, feature_index
                                  ],
                              ]
                          ),
                          color="limegreen",
                      )
              if std is not None:
                  import scipy.stats
  
                  ppf_value = scipy.stats.norm.ppf(prediction_interval)
                  ax.fill_between(
                      y_index,
                      y[instance_index, :, feature_index]
                      - std[instance_index, :, feature_index]
                      * ppf_value,
                      y[instance_index, :, feature_index]
                      + std[instance_index, :, feature_index]
                      * ppf_value,
                      alpha=0.2,
                  )
              if ground_truth is not None:
                  ax.legend(["prediction", "ground truth"])
              else:
                  ax.legend(["prediction"])
              ax.set_title(f"index {instance_index}")
              iter_num += 1
  
      if output_file:
          plt.savefig(output_file)
  
file_path: BigDL/python/chronos/src/bigdl/chronos/metric/forecast_metrics.py
imports: from numpy import ndarray
  import numpy
  from bigdl.nano.utils.common import invalidInputError
  from timeit import repeat
  import random
label_desc: Use image node_id 3 for calling the Evaluator obj's underlying member method code with example usage: obj.plot(y, std, ground_truth, x, feature_index, instance_index, layout, prediction_interval, figsize, output_file) without return types