code: private void backward(TrellisNode[][] trellis) {
          int n = trellis.length - 1;
          TrellisNode[] tn = trellis[n];
          for (int i = 0; i < numClasses; i++) {
              tn[i].beta = 1.0;
          }
  
          for (int t = n; t-- > 0;) {
              TrellisNode[] tt = trellis[t];
              TrellisNode[] tt1 = trellis[t+1];
              for (int i = 0; i < numClasses; i++) {
                  TrellisNode tti = tt[i];
                  tti.beta = 0.0;
                  for (int j = 0; j < numClasses; j++) {
                      tti.beta += tt1[j].expScores[i] * tt1[j].beta;
                  }
              }
  
              // Normalize beta values since they increase quickly
              double sum = 0.0;
              for (int i = 0; i < numClasses; i++) {
                  sum += tt[i].beta;
              }
              for (int i = 0; i < numClasses; i++) {
                  tt[i].beta /= sum;
              }
          }
      }
docs: Performs backward procedure on the trellis.