class_docstr: LightGBM Model for high frequency prediction
class_docstr_tok: ["LightGBM","Model","for","high","frequency","prediction"]
docstr: Test the signal in high frequency test set
docstr_tok: ["Test","the","signal","in","high","frequency","test","set"]
code: def hf_signal_test(self, dataset: DatasetH, threhold=0.2):
      """
      Test the signal in high frequency test set
      """
      if self.model is None:
          raise ValueError("Model hasn't been trained yet")
      df_test = dataset.prepare(
          "test",
          col_set=["feature", "label"],
          data_key=DataHandlerLP.DK_I,
      )
      df_test.dropna(inplace=True)
      x_test, y_test = df_test["feature"], df_test["label"]
      # Convert label into alpha
      y_test[y_test.columns[0]] = y_test[y_test.columns[0]] - y_test[
          y_test.columns[0]
      ].mean(level=0)
  
      res = pd.Series(
          self.model.predict(x_test.values), index=x_test.index
      )
      y_test["pred"] = res
  
      up_p, down_p, up_a, down_a = self._cal_signal_metrics(
          y_test, threhold, 1 - threhold
      )
      print("===============================")
      print("High frequency signal test")
      print("===============================")
      print("Test set precision: ")
      print(
          "Positive precision: {}, Negative precision: {}".format(
              up_p, down_p
          )
      )
      print("Test Alpha Average in test set: ")
      print(
          "Positive average alpha: {}, Negative average alpha: {}".format(
              up_a, down_a
          )
      )
  
file_path: qlib/qlib/contrib/model/highfreq_gdbt_model.py
imports: import warnings
  import numpy
  import pandas
  import lightgbm
  from ...model.base import ModelFT
  from ...data.dataset import DatasetH
  from ...data.dataset.handler import DataHandlerLP
  from ...model.interpret.base import LightGBMFInt
label_desc: Use image node_id 3 for calling the HFLGBModel obj's underlying member method code with example usage: obj.hf_signal_test(dataset, threhold) without return types