class_docstr: Double Ensemble Model
docstr: the SR module of Double Ensemble
  :param loss_curve: the shape is NxT
  the loss curve for the previous sub-model, where the element (i, t) if the error on the i-th sample
  after the t-th iteration in the training of the previous sub-model.
  :param loss_values: the shape is N
  the loss of the current ensemble on the i-th sample.
  :param k_th: the index of the current sub-model, starting from 1
  :return: weights
  the weights for all the samples.
docstr_tok: ["the","SR","module","of","Double","Ensemble",":","param","loss_curve",":","the","shape","is","NxT","the","loss","curve","for","the","previous","sub-model",",","where","the","element","(","i",",","t",")","if","the","error","on","the","i-th","sample","after","the","t-th","iteration","in","the","training","of","the","previous","sub-model",".",":","param","loss_values",":","the","shape","is","N","the","loss","of","the","current","ensemble","on","the","i-th","sample",".",":","param","k_th",":","the","index","of","the","current","sub-model",",","starting","from","1",":","return",":","weights","the","weights","for","all","the","samples","."]
code: def sample_reweight(self, loss_curve, loss_values, k_th):
      """
      the SR module of Double Ensemble
      :param loss_curve: the shape is NxT
      the loss curve for the previous sub-model, where the element (i, t) if the error on the i-th sample
      after the t-th iteration in the training of the previous sub-model.
      :param loss_values: the shape is N
      the loss of the current ensemble on the i-th sample.
      :param k_th: the index of the current sub-model, starting from 1
      :return: weights
      the weights for all the samples.
      """
      # normalize loss_curve and loss_values with ranking
      loss_curve_norm = loss_curve.rank(axis=0, pct=True)
      loss_values_norm = (-loss_values).rank(pct=True)
  
      # calculate l_start and l_end from loss_curve
      N, T = loss_curve.shape
      part = np.maximum(int(T * 0.1), 1)
      l_start = loss_curve_norm.iloc[:, :part].mean(axis=1)
      l_end = loss_curve_norm.iloc[:, -part:].mean(axis=1)
  
      # calculate h-value for each sample
      h1 = loss_values_norm
      h2 = (l_end / l_start).rank(pct=True)
      h = pd.DataFrame({"h_value": self.alpha1 * h1 + self.alpha2 * h2})
  
      # calculate weights
      h["bins"] = pd.cut(h["h_value"], self.bins_sr)
      h_avg = h.groupby("bins")["h_value"].mean()
      weights = pd.Series(np.zeros(N, dtype=float))
      for b in h_avg.index:
          weights[h["bins"] == b] = 1.0 / (
              self.decay**k_th * h_avg[b] + 0.1
          )
      return weights
  
imports: import lightgbm
  import numpy
  import pandas
  from typing import Text, Union
  from ...model.base import Model
  from ...data.dataset import DatasetH
  from ...data.dataset.handler import DataHandlerLP
  from ...model.interpret.base import FeatureInt
  from ...log import get_module_logger
label_desc: Use image node_id 5 for calling the DEnsembleModel obj's underlying member method code with example usage: obj.sample_reweight(loss_curve, loss_values, k_th) and returns: weights