code: def backtest_analysis(pred, rid, uri_path: str = None):
      """backtest and analysis
  
      Parameters
      ----------
      rid : str
          the id of the recorder to be used in this function
      uri_path: str
          mlflow uri path
  
      Returns
      -------
      analysis : pandas.DataFrame
          the analysis result
  
      """
      with R.uri_context(uri=uri_path):
          recorder = R.get_recorder(
              experiment_name="workflow", recorder_id=rid
          )
  
      dataset = init_instance_by_config(CSI300_GBDT_TASK["dataset"])
      model = recorder.load_object("trained_model")
  
      port_analysis_config = {
          "executor": {
              "class": "SimulatorExecutor",
              "module_path": "qlib.backtest.executor",
              "kwargs": {
                  "time_per_step": "day",
                  "generate_portfolio_metrics": True,
              },
          },
          "strategy": {
              "class": "TopkDropoutStrategy",
              "module_path": "qlib.contrib.strategy.signal_strategy",
              "kwargs": {
                  "signal": (model, dataset),
                  "topk": 50,
                  "n_drop": 5,
              },
          },
          "backtest": {
              "start_time": "2017-01-01",
              "end_time": "2020-08-01",
              "account": 100000000,
              "benchmark": CSI300_BENCH,
              "exchange_kwargs": {
                  "freq": "day",
                  "limit_threshold": 0.095,
                  "deal_price": "close",
                  "open_cost": 0.0005,
                  "close_cost": 0.0015,
                  "min_cost": 5,
              },
          },
      }
      # backtest
      par = PortAnaRecord(
          recorder, port_analysis_config, risk_analysis_freq="day"
      )
      par.generate()
      analysis_df = par.load("port_analysis_1day.pkl")
      print(analysis_df)
      return analysis_df
  
imports: import sys
  import shutil
  import unittest
  import pytest
  from pathlib import Path
  import qlib
  from qlib.config import C
  from qlib.utils import init_instance_by_config, flatten_dict
  from qlib.workflow import R
  from qlib.workflow.record_temp import SignalRecord, SigAnaRecord, PortAnaRecord
  from qlib.tests import TestAutoData
  from qlib.tests.config import CSI300_GBDT_TASK, CSI300_BENCH
label_desc: Use image node_id 3 for calling a global function with example usage: backtest_analysis(pred, rid, uri_path) and returns: analysis_df