List of usage examples for org.apache.commons.lang3.mutable MutableDouble intValue
@Override public int intValue()
From source file:eu.project.ttc.models.CrossTable.java
/** * //from w ww. j a v a 2 s . c o m * Computes coefficients a, b, c and d (available) and computes the association * rate based on these coefficients. * * These coefficients are made available through the not-thread safe methods <code>#getLastX()</code>. * * @see #getLastA() * @see #getLastB() * @see #getLastC() * @see #getLastD() * * @param rate * the association rate measure * @param x * the base term * @param y * the co term * @return * the association rate */ public double computeRate(AssociationRate rate, Term x, Term y) { // A = (x & y) int a = (int) x.getContextVector().getNbCooccs(y); // B = (x & not(y)) MutableDouble a_plus_b = this.aPlusB.get(x); int b = a_plus_b == null ? 0 : a_plus_b.intValue() - a; // int b = x.getFrequency() - a; // C = (not(x) & y) MutableDouble a_plus_c = this.aPlusB.get(y); int c = a_plus_c == null ? 0 : a_plus_c.intValue() - a; // int c = y.getFrequency() - a; // D = (not(x) & not(y)) int d = this.totalCoOccurrences - a - b - c; // int d = this.totalFrequency - a - b - c; // for DEBUG purpose only lastA = a; lastB = b; lastC = c; lastD = d; // END DEBUG final double value = rate.getValue(a, b, c, d); return value; }