// Path: src/utils/NumericalFunctions.java
// public class NumericalFunctions {
// 	public static double addLogs(double x, double y) {
// 		if (y <= x) {
// 			return x + Math.log1p(Math.exp(y - x));
// 		} else {
// 			return y + Math.log1p(Math.exp(x - y));
// 		}
// 	}
// 
// 	/*
// 	 * e^x + e^y = e^z - need to solve for z
// 	 * 
// 	 * z = log(e^x + e^y) = log(e^x.(e^x + e^y)/e^x) = x + log(1 + e^(y-x))
// 	 * 
// 	 * useful since e^(y-x) is presumably easier to calculate than either e^x or
// 	 * e^y
// 	 */
// 
// 	public static double adaGradUpdate(double gradient, double sumGradSquared, double learningRate) {
// 		double eps = 0.001;
// 
// 		return learningRate * gradient / (Math.sqrt(sumGradSquared) + eps);
// 	}
// }


import utils.NumericalFunctions;

				if (viterbiScore > maxScore) {
					maxScore = viterbiScore;
					maxNode = node;
				}
			}
		}
		if (maxNode != null) {
			maxNode.viterbiMarker = true; // mark the conjNode as being in the
			// highest scoring derivation
		} else {
			throw new Error("shld always have a maxNode!");
		}

		score = maxScore; // keep this in case we see this node again
		marker = true; // record the fact we've been here

		return maxScore;
	}

	public void calcInside(boolean gold) {
		score = 0.0;

		for (int i = 0; i < conjNodes.length; i++) {
			ConjNode node = conjNodes[i];
			if (!gold || node.goldMarker) {
				if (score == 0.0) {
					score = node.calcInside(); // need to get a non-zero score
					// before passing to addLogs (?)
				} else {
// Path: src/utils/NumericalFunctions.java
// public class NumericalFunctions {
// 	public static double addLogs(double x, double y) {
// 		if (y <= x) {
// 			return x + Math.log1p(Math.exp(y - x));
// 		} else {
// 			return y + Math.log1p(Math.exp(x - y));
// 		}
// 	}
// 
// 	/*
// 	 * e^x + e^y = e^z - need to solve for z
// 	 * 
// 	 * z = log(e^x + e^y) = log(e^x.(e^x + e^y)/e^x) = x + log(1 + e^(y-x))
// 	 * 
// 	 * useful since e^(y-x) is presumably easier to calculate than either e^x or
// 	 * e^y
// 	 */
// 
// 	public static double adaGradUpdate(double gradient, double sumGradSquared, double learningRate) {
// 		double eps = 0.001;
// 
// 		return learningRate * gradient / (Math.sqrt(sumGradSquared) + eps);
// 	}
// }


// Path: src/training/DisjNode.java
import utils.NumericalFunctions;


				if (viterbiScore > maxScore) {
					maxScore = viterbiScore;
					maxNode = node;
				}
			}
		}
		if (maxNode != null) {
			maxNode.viterbiMarker = true; // mark the conjNode as being in the
			// highest scoring derivation
		} else {
			throw new Error("shld always have a maxNode!");
		}

		score = maxScore; // keep this in case we see this node again
		marker = true; // record the fact we've been here

		return maxScore;
	}

	public void calcInside(boolean gold) {
		score = 0.0;

		for (int i = 0; i < conjNodes.length; i++) {
			ConjNode node = conjNodes[i];
			if (!gold || node.goldMarker) {
				if (score == 0.0) {
					score = node.calcInside(); // need to get a non-zero score
					// before passing to addLogs (?)
				} else {
					score = NumericalFunctions