class_docstr: Forecaster base model for lstm, mtnet, seq2seq and tcn forecasters.
class_docstr_tok: ["Forecaster","base","model","for","lstm",",","mtnet",",","seq2seq","and","tcn","forecasters","."]
docstr: Evaluate using a trained forecaster with onnxruntime. The method can only be
  used when forecaster is a non-distributed version.
  
  Directly call this method without calling build_onnx is valid and Forecaster will
  automatically build an onnxruntime session with default settings.
  
  Please note that evaluate result is calculated by scaled y and yhat. If you scaled
  your data (e.g. use .scale() on the TSDataset) please follow the following code
  snap to evaluate your result if you need to evaluate on unscaled data.
  
  >>> from zoo.orca.automl.metrics import Evaluator
  >>> y_hat = forecaster.predict(x)
  >>> y_hat_unscaled = tsdata.unscale_numpy(y_hat) # or other customized unscale methods
  >>> y_unscaled = tsdata.unscale_numpy(y) # or other customized unscale methods
  >>> Evaluator.evaluate(metric=..., y_unscaled, y_hat_unscaled, multioutput=...)
  
  :param data: The data support following formats:
  
         | 1. a numpy ndarray tuple (x, y):
         | x's shape is (num_samples, lookback, feature_dim) where lookback and feature_dim
         | should be the same as past_seq_len and input_feature_num.
         | y's shape is (num_samples, horizon, target_dim), where horizon and target_dim
         | should be the same as future_seq_len and output_feature_num.
  
  :param batch_size: evaluate batch size. The value will not affect evaluate
         result but will affect resources cost(e.g. memory and time).
  :param dirname: The directory to save onnx model file. This value defaults
         to None for no saving file.
  :param multioutput: Defines aggregating of multiple output values.
         String in ['raw_values', 'uniform_average']. The value defaults to
         'raw_values'.
  
  :return: A list of evaluation results. Each item represents a metric.
docstr_tok: ["Evaluate","using","a","trained","forecaster","with","onnxruntime",".","The","method","can","only","be","used","when","forecaster","is","a","non-distributed","version",".","Directly","call","this","method","without","calling","build_onnx","is","valid","and","Forecaster","will","automatically","build","an","onnxruntime","session","with","default","settings",".","Please","note","that","evaluate","result","is","calculated","by","scaled","y","and","yhat",".","If","you","scaled","your","data","(","e.g",".","use",".scale","(",")","on","the","TSDataset",")","please","follow","the","following","code","snap","to","evaluate","your","result","if","you","need","to","evaluate","on","unscaled","data",".",">",">",">","from","zoo.orca.automl.metrics","import","Evaluator",">",">",">","y_hat","=","forecaster.predict","(","x",")",">",">",">","y_hat_unscaled","=","tsdata.unscale_numpy","(","y_hat",")","#","or","other","customized","unscale","methods",">",">",">","y_unscaled","=","tsdata.unscale_numpy","(","y",")","#","or","other","customized","unscale","methods",">",">",">","Evaluator.evaluate","(","metric=","...",",","y_unscaled",",","y_hat_unscaled",",","multioutput=","...",")",":","param","data",":","The","data","support","following","formats",":","|","1.","a","numpy","ndarray","tuple","(","x",",","y",")",":","|","x","'s","shape","is","(","num_samples",",","lookback",",","feature_dim",")","where","lookback","and","feature_dim","|","should","be","the","same","as","past_seq_len","and","input_feature_num",".","|","y","'s","shape","is","(","num_samples",",","horizon",",","target_dim",")",",","where","horizon","and","target_dim","|","should","be","the","same","as","future_seq_len","and","output_feature_num",".",":","param","batch_size",":","evaluate","batch","size",".","The","value","will","not","affect","evaluate","result","but","will","affect","resources","cost","(","e.g",".","memory","and","time",")",".",":","param","dirname",":","The","directory","to","save","onnx","model","file",".","This","value","defaults","to","None","for","no","saving","file",".",":","param","multioutput",":","Defines","aggregating","of","multiple","output","values",".","String","in","[","'raw_values","'",",","'uniform_average","'","]",".","The","value","defaults","to","'raw_values","'",".",":","return",":","A","list","of","evaluation","results",".","Each","item","represents","a","metric","."]
code: def evaluate_with_onnx(
      self, data, batch_size=32, dirname=None, multioutput="raw_values"
  ):
      """
      Evaluate using a trained forecaster with onnxruntime. The method can only be
      used when forecaster is a non-distributed version.
  
      Directly call this method without calling build_onnx is valid and Forecaster will
      automatically build an onnxruntime session with default settings.
  
      Please note that evaluate result is calculated by scaled y and yhat. If you scaled
      your data (e.g. use .scale() on the TSDataset) please follow the following code
      snap to evaluate your result if you need to evaluate on unscaled data.
  
      >>> from zoo.orca.automl.metrics import Evaluator
      >>> y_hat = forecaster.predict(x)
      >>> y_hat_unscaled = tsdata.unscale_numpy(y_hat) # or other customized unscale methods
      >>> y_unscaled = tsdata.unscale_numpy(y) # or other customized unscale methods
      >>> Evaluator.evaluate(metric=..., y_unscaled, y_hat_unscaled, multioutput=...)
  
      :param data: The data support following formats:
  
             | 1. a numpy ndarray tuple (x, y):
             | x's shape is (num_samples, lookback, feature_dim) where lookback and feature_dim
             | should be the same as past_seq_len and input_feature_num.
             | y's shape is (num_samples, horizon, target_dim), where horizon and target_dim
             | should be the same as future_seq_len and output_feature_num.
  
      :param batch_size: evaluate batch size. The value will not affect evaluate
             result but will affect resources cost(e.g. memory and time).
      :param dirname: The directory to save onnx model file. This value defaults
             to None for no saving file.
      :param multioutput: Defines aggregating of multiple output values.
             String in ['raw_values', 'uniform_average']. The value defaults to
             'raw_values'.
  
      :return: A list of evaluation results. Each item represents a metric.
      """
      if self.distributed:
          raise NotImplementedError(
              "ONNX inference has not been supported for distributed\
                                         forecaster. You can call .to_local() to transform the\
                                         forecaster to a non-distributed version."
          )
      if not self.internal.model_built:
          raise RuntimeError(
              "You must call fit or restore first before calling evaluate!"
          )
      return self.internal.evaluate_with_onnx(
          data[0],
          data[1],
          metrics=self.metrics,
          dirname=dirname,
          multioutput=multioutput,
          batch_size=batch_size,
      )
  
file_path: analytics-zoo/pyzoo/zoo/chronos/forecaster/base_forecaster.py
imports: from zoo.chronos.forecaster.abstract import Forecaster
  from zoo.orca.data.shard import SparkXShards
  from zoo.chronos.forecaster.utils import np_to_creator, set_pytorch_seed, check_data, xshard_to_np, np_to_xshard
  import numpy
  from zoo.orca.learn.pytorch.estimator import Estimator
  from zoo.orca.learn.metrics import MSE, MAE
label_desc: Use image node_id 6 for calling the BasePytorchForecaster obj's underlying member method code with example usage: obj.evaluate_with_onnx(data, batch_size, dirname, multioutput) and returns: self