class_docstr: Base model to run the test
class_docstr_tok: ["Base","model","to","run","the","test"]
docstr: To eval the predict results with specified metric
  :param data:
  :param pred:
  :return:
docstr_tok: ["To","eval","the","predict","results","with","specified","metric",":","param","data",":",":","param","pred",":",":","return",":"]
code: def eval(self, data, pred):
      """
      To eval the predict results with specified metric
      :param data:
      :param pred:
      :return:
      """
      if data.metric == "RMSE":
          with open("pred", "w") as f:
              for x in pred:
                  f.write(str(x) + "\n")
          return np.sqrt(mean_squared_error(data.y_test, pred))
      elif data.metric == "Accuracy":
          # Threshold prediction if binary classification
          if data.task == "Classification":
              pred = pred > 0.5
          elif data.task == "Multiclass classification":
              if pred.ndim > 1:
                  pred = np.argmax(pred, axis=1)
          return accuracy_score(data.y_test, pred)
      else:
          raise ValueError("Unknown metric: " + data.metric)
  
file_path: thundergbm/python/benchmarks/model/base_model.py
imports: import numpy
  from sklearn.metrics import mean_squared_error, accuracy_score
label_desc: Use image node_id 5 for calling the BaseModel obj's underlying member method code with example usage: obj.eval(data, pred) and returns: np, accuracy_score