class_docstr: emotion postprocess
class_docstr_tok: ["emotion","postprocess"]
docstr: smoothing score and predict label 
docstr_tok: ["smoothing","score","and","predict","label"]
code: def post_proc_results(self, results, thresholds=None):
      """smoothing score and predict label"""
      thresholds = thresholds or np.linspace(
          0, 1, num=10, endpoint=False
      )
      for threshold in thresholds:
          output_path = os.path.join(
              self.output_dir, "predict_ths_%3f.txt" % (threshold)
          )
          with open(output_path, "w") as predfile:
              # history len `maxlen`
              smoothing = self.smoothing
              maxlen = self.smoothing_cnt
              history = collections.deque(maxlen=maxlen)
              vote_all = collections.deque(maxlen=maxlen)
  
              for path in results:  # filepath
                  # sort file clips by `clipid`
                  clips = results[path]
                  clips.sort(key=lambda entry: entry["clipid"])
                  pos_cnt = 0
  
                  for elem in clips:  # clipid
                      clipid = elem["clipid"]
                      label = elem["label"]
                      score = elem["softmax"]
  
                      # append history deque
                      y_pos = score[self.positive_id]
                      history.append(y_pos)
  
                      hist = list(history)
                      if smoothing:
                          # smoothing
                          y_pos = np.mean(hist)
                      else:
                          pass
  
                      # predict result for file
                      if y_pos > threshold:
                          y_pred = self.positive_id
                      else:
                          y_pred = 1 - self.positive_id
  
                      if y_pred == self.positive_id:
                          pos_cnt += 1
                          vote_all.append(True)
                      logging.info(
                          "file {}, clipid {}, label {}, pred {}".format(
                              path, clipid, label, y_pred
                          )
                      )
  
                  # sentence_pred = pos_cnt >= FLAGS.threshold
                  sentence_pred = all(list(vote_all))
                  sentence_label = (
                      self.positive_id
                      if "conflict" in str(path)
                      else (1 - self.positive_id)
                  )
  
                  logging.info(
                      "file ths_{}: {} {} {}".format(
                          threshold, path, pos_cnt, sentence_pred
                      )
                  )
  
                  predfile.write(
                      "{} {} {}\n".format(path, sentence_label, pos_cnt)
                  )
  
file_path: delta/delta/utils/postprocess/speech_cls_proc.py
imports: import os
  import pickle
  import collections
  import numpy
  from absl import logging
  from sklearn.metrics import confusion_matrix
  from delta import utils
  from delta.utils.postprocess.base_postproc import PostProc
  from delta.utils.register import registers
label_desc: Use image node_id 6 for calling the EmoPostProc obj's underlying member method code with example usage: obj.post_proc_results(results, thresholds) without return types