public static <D> Counter<D> FScore(Counter<D> precision, Counter<D> recall, double beta) { double betasq = beta * beta; return Counters.divisionNonNaN(Counters.scale(Counters.product(precision, recall), (1 + betasq)), (Counters.add(Counters.scale(precision, betasq), recall))); }
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); }
Counter<E> add = Counters.add(sensitivity, specificity); Counter<E> product = Counters.product(sensitivity, specificity);
Counter<String> precision = Counters.division(entityTP, Counters.add(entityTP, entityFP)); Counter<String> recall = Counters.division(entityTP, Counters.add(entityTP, entityFN)); Redwood.log(ConstantsAndVariables.minimaldebug, "\nFor label " + label + " Precision: " + precision + ", Recall: " + recall + ", F1 score: " + FScore(precision, recall, 1));
Counter<E> all_i = Counters.add(pos_i, neg_i); all_i.addAll(unlab_i); Counter<E> posneg_i = Counters.add(pos_i, neg_i); Counter<E> logFi = new ClassicCounter<>(pos_i); Counters.logInPlace(logFi); Counters.division(pos_i, Counters.add(neg_i, unlab_i)), logFi); } else if (patternScoring.equals(PatternScoring.RlogFNeg)) { Redwood.log("extremePatDebug", "computing rlogfneg"); Counters.add(pos_i, neg_i)); double thetaPrecision = 0.8; Counters.retainAbove(acc, thetaPrecision); Counters.add(pos_i, neg_i)); double thetaPrecision = 0.8; Counters.retainAbove(acc, thetaPrecision); Counter<E> conf = Counters.product(Counters.division( Counters.add(pos_i, Counters.scale(neg_i, -1)), all_i), logFi); for (E p : acc.keySet()) { currentPatternWeights4Label.setCount(p, conf.getCount(p));
public static <D> Counter<D> FScore(Counter<D> precision, Counter<D> recall, double beta) { double betasq = beta * beta; return Counters.divisionNonNaN(Counters.scale(Counters.product(precision, recall), (1 + betasq)), (Counters.add(Counters.scale(precision, betasq), recall))); }
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 <D> Counter<D> FScore(Counter<D> precision, Counter<D> recall, double beta) { double betasq = beta * beta; return Counters.divisionNonNaN(Counters.scale(Counters.product(precision, recall), (1 + betasq)), (Counters.add(Counters.scale(precision, betasq), recall))); }
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); }
Counter<E> add = Counters.add(sensitivity, specificity); Counter<E> product = Counters.product(sensitivity, specificity);
Counter<SurfacePattern> add = Counters.add(sensitivity, specificity); Counter<SurfacePattern> product = Counters.product(sensitivity, specificity);
Counter<String> precision = Counters.division(entityTP, Counters.add(entityTP, entityFP)); Counter<String> recall = Counters.division(entityTP, Counters.add(entityTP, entityFN)); Redwood.log(ConstantsAndVariables.minimaldebug, "\nFor label " + label + " Precision: " + precision + ", Recall: " + recall + ", F1 score: " + FScore(precision, recall, 1));
Counter<String> precision = Counters.division(entityTP, Counters.add(entityTP, entityFP)); Counter<String> recall = Counters.division(entityTP, Counters.add(entityTP, entityFN)); Redwood.log(ConstantsAndVariables.minimaldebug, "\nFor label " + label + " Precision: " + precision + ", Recall: " + recall + ", F1 score: " + FScore(precision, recall, 1));
Counter<E> all_i = Counters.add(pos_i, neg_i); all_i.addAll(unlab_i); Counter<E> posneg_i = Counters.add(pos_i, neg_i); Counter<E> logFi = new ClassicCounter<>(pos_i); Counters.logInPlace(logFi); Counters.division(pos_i, Counters.add(neg_i, unlab_i)), logFi); } else if (patternScoring.equals(PatternScoring.RlogFNeg)) { Redwood.log("extremePatDebug", "computing rlogfneg"); Counters.add(pos_i, neg_i)); double thetaPrecision = 0.8; Counters.retainAbove(acc, thetaPrecision); Counters.add(pos_i, neg_i)); double thetaPrecision = 0.8; Counters.retainAbove(acc, thetaPrecision); Counter<E> conf = Counters.product(Counters.division( Counters.add(pos_i, Counters.scale(neg_i, -1)), all_i), logFi); for (E p : acc.keySet()) { currentPatternWeights4Label.setCount(p, conf.getCount(p));
Counter<SurfacePattern> posneg_i = Counters.add(pos_i, neg_i); Counter<SurfacePattern> logFi = new ClassicCounter<SurfacePattern>(pos_i); Counters.logInPlace(logFi); Counters.division(pos_i, Counters.add(neg_i, unlab_i)), logFi); } else if (patternScoring.equals(PatternScoring.RlogFNeg)) { Redwood.log("extremePatDebug", "computing rlogfneg"); Counters.add(pos_i, neg_i)); double thetaPrecision = 0.8; Counters.retainAbove(acc, thetaPrecision); Counters.add(pos_i, neg_i)); double thetaPrecision = 0.8; Counters.retainAbove(acc, thetaPrecision); Counter<SurfacePattern> conf = Counters.product(Counters.division( Counters.add(pos_i, Counters.scale(neg_i, -1)), all_i), logFi); for (SurfacePattern p : acc.keySet()) { currentPatternWeights4Label.setCount(p, conf.getCount(p));