/** * Normalizes the target counter in-place, so the sum of the resulting values * equals 1. * * @param <E> Type of elements in TwoDimensionalCounter * @param <F> Type of elements in TwoDimensionalCounter */ public static <E, F> void normalize(TwoDimensionalCounter<E, F> target) { Counters.divideInPlace(target, target.totalCount()); }
/** * Normalizes the target counter in-place, so the sum of the resulting values * equals 1. * * @param <E> Type of elements in Counter */ public static <E> void normalize(Counter<E> target) { divideInPlace(target, target.totalCount()); }
public static<A,B> void divideInPlace(TwoDimensionalCounter<A, B> counter, double divisor) { for(Entry<A, ClassicCounter<B>> c: counter.entrySet()){ Counters.divideInPlace(c.getValue(), divisor); } counter.recomputeTotal(); }
public ClassicCounter<OUT> lastPrecision() { ClassicCounter<OUT> result = new ClassicCounter<>(); Counters.addInPlace(result, previousGuessedCorrect); Counters.divideInPlace(result, previousGuessed); return result; }
public ClassicCounter<OUT> lastRecall() { ClassicCounter<OUT> result = new ClassicCounter<>(); Counters.addInPlace(result, previousGoldCorrect); Counters.divideInPlace(result, previousGold); return result; }
public static<E> double pearsonsCorrelationCoefficient(Counter<E> x, Counter<E> y){ double stddevX = Counters.standardDeviation(x); double stddevY = Counters.standardDeviation(y); double meanX = Counters.mean(x); double meanY = Counters.mean(y); Counter<E> t1 = Counters.add(x, -meanX); Counter<E> t2 = Counters.add(y, -meanY); Counters.divideInPlace(t1, stddevX); Counters.divideInPlace(t2, stddevY); return Counters.dotProduct(t1, t2)/ (double)(x.size() -1); }
Counters.divideInPlace(tfidfScores, Data.processedDataFreq);
/** * Normalizes the target counter in-place, so the sum of the resulting values * equals 1. * * @param <E> Type of elements in TwoDimensionalCounter * @param <F> Type of elements in TwoDimensionalCounter */ public static <E, F> void normalize(TwoDimensionalCounter<E, F> target) { Counters.divideInPlace(target, target.totalCount()); }
/** * Normalizes the target counter in-place, so the sum of the resulting values * equals 1. * * @param <E> Type of elements in Counter */ public static <E> void normalize(Counter<E> target) { divideInPlace(target, target.totalCount()); }
/** * Normalizes the target counter in-place, so the sum of the resulting values * equals 1. * * @param <E> Type of elements in TwoDimensionalCounter * @param <F> Type of elements in TwoDimensionalCounter */ public static <E, F> void normalize(TwoDimensionalCounter<E, F> target) { Counters.divideInPlace(target, target.totalCount()); }
/** * Normalizes the target counter in-place, so the sum of the resulting values * equals 1. * * @param <E> Type of elements in Counter */ public static <E> void normalize(Counter<E> target) { divideInPlace(target, target.totalCount()); }
/** * Normalizes the target counter in-place, so the sum of the resulting values * equals 1. * * @param <E> Type of elements in TwoDimensionalCounter * @param <F> Type of elements in TwoDimensionalCounter */ public static <E, F> void normalize(TwoDimensionalCounter<E, F> target) { Counters.divideInPlace(target, target.totalCount()); }
public static<A,B> void divideInPlace(TwoDimensionalCounter<A, B> counter, double divisor) { for(Entry<A, ClassicCounter<B>> c: counter.entrySet()){ Counters.divideInPlace(c.getValue(), divisor); } counter.recomputeTotal(); }
public static<A,B> void divideInPlace(TwoDimensionalCounter<A, B> counter, double divisor) { for(Entry<A, ClassicCounter<B>> c: counter.entrySet()){ Counters.divideInPlace(c.getValue(), divisor); } counter.recomputeTotal(); }
public static<A,B> void divideInPlace(TwoDimensionalCounter<A, B> counter, double divisor) { for(Entry<A, ClassicCounter<B>> c: counter.entrySet()){ Counters.divideInPlace(c.getValue(), divisor); } counter.recomputeTotal(); }
public ClassicCounter<OUT> lastRecall() { ClassicCounter<OUT> result = new ClassicCounter<OUT>(); Counters.addInPlace(result, previousGoldCorrect); Counters.divideInPlace(result, previousGold); return result; }
public ClassicCounter<OUT> lastPrecision() { ClassicCounter<OUT> result = new ClassicCounter<OUT>(); Counters.addInPlace(result, previousGuessedCorrect); Counters.divideInPlace(result, previousGuessed); return result; }
public static<E> double pearsonsCorrelationCoefficient(Counter<E> x, Counter<E> y){ double stddevX = Counters.standardDeviation(x); double stddevY = Counters.standardDeviation(y); double meanX = Counters.mean(x); double meanY = Counters.mean(y); Counter<E> t1 = Counters.add(x, -meanX); Counter<E> t2 = Counters.add(y, -meanY); Counters.divideInPlace(t1, stddevX); Counters.divideInPlace(t2, stddevY); return Counters.dotProduct(t1, t2)/ (double)(x.size() -1); }
public static<E> double pearsonsCorrelationCoefficient(Counter<E> x, Counter<E> y){ double stddevX = Counters.standardDeviation(x); double stddevY = Counters.standardDeviation(y); double meanX = Counters.mean(x); double meanY = Counters.mean(y); Counter<E> t1 = Counters.add(x, -meanX); Counter<E> t2 = Counters.add(y, -meanY); Counters.divideInPlace(t1, stddevX); Counters.divideInPlace(t2, stddevY); return Counters.dotProduct(t1, t2)/ (double)(x.size() -1); }
public static<E> double pearsonsCorrelationCoefficient(Counter<E> x, Counter<E> y){ double stddevX = Counters.standardDeviation(x); double stddevY = Counters.standardDeviation(y); double meanX = Counters.mean(x); double meanY = Counters.mean(y); Counter<E> t1 = Counters.add(x, -meanX); Counter<E> t2 = Counters.add(y, -meanY); Counters.divideInPlace(t1, stddevX); Counters.divideInPlace(t2, stddevY); return Counters.dotProduct(t1, t2)/ (double)(x.size() -1); }