public void MaxForwardDUMMY(ViterbiTrace[] traces, RiggedArray palpha, RiggedArray calpha) { for (int i = 0; i < palpha.Length; ++i) { if (palpha.pruned[i] || calpha.pruned[i]) { continue; } double s = calpha.v[i]; if (s > palpha.v[i]) { traces[i].edge = this; traces[i].subtag0 = i; traces[i].subtag1 = -1; palpha.v[i] = s; } } }
public void MaxForward(ViterbiTrace[] traces, RiggedArray palpha, double[][] unaryScores, RiggedArray calpha) { for (int c = 0; c < calpha.Length; ++c) { if (calpha.pruned[c] || double.IsNegativeInfinity(calpha.v[c]) || unaryScores[c] == null) { continue; } //MathHelper.ax_addto_y(calpha[c], unaryScores[c], palpha); for (int p = 0; p < palpha.Length; ++p) { if (palpha.pruned[p]) { continue; } double s = calpha.v[c] + unaryScores[c][p]; if (s > palpha.v[p]) { traces[p].edge = this; traces[p].subtag0 = c; traces[p].subtag1 = -1; palpha.v[p] = s; } } } }
public void MaxForward(ViterbiTrace[] traces, RiggedArray palpha, double[][][] binaryScores, RiggedArray lalpha, RiggedArray ralpha) { for (int l = 0; l < lalpha.Length; ++l) { if (lalpha.pruned[l] || double.IsNegativeInfinity(lalpha.v[l]) || binaryScores[l] == null) { continue; } for (int r = 0; r < ralpha.Length; ++r) { if (ralpha.pruned[r] || double.IsNegativeInfinity(ralpha.v[r]) || binaryScores[l][r] == null) { continue; } //MathHelper.ax_addto_y(lalpha[l] * ralpha[r], binaryScores[l][r], palpha); double x = lalpha.v[l] + ralpha.v[r]; for (int p = 0; p < palpha.Length; ++p) { if (palpha.pruned[p]) { continue; } double s = x + binaryScores[l][r][p]; if (s > palpha.v[p]) { traces[p].edge = this; traces[p].subtag0 = l; traces[p].subtag1 = r; palpha.v[p] = s; } } } } }
public void MaxForward(ViterbiTrace[] traces, RiggedArray palpha, double[] terminalScores) { //MathHelper.ax_addto_y(1.0f, terminalScores, palpha); for (int i = 0; i < terminalScores.Length; ++i) { if (palpha.pruned[i]) { continue; } if (terminalScores[i] > palpha.v[i]) { traces[i].edge = this; traces[i].subtag0 = 0; traces[i].subtag1 = -1; palpha.v[i] = terminalScores[i]; } //palpha.v[i] = MathHelper.LogAdd(palpha.v[i], terminalScores[i]); } }