CDFitness implements Writable { public double get() { double se = (double) tp / (tp + fn); double sp = (double) tn / (tn + fp); return se * sp; } CDFitness();  CDFitness(CDFitness f);  CDFitness(int tp, int fp, int tn, int fn); int getTp(); int getFp(); int getTn(); int getFn(); void add(CDFitness f); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); double get(); @Override void readFields(DataInput in); @Override void write(DataOutput out);  }
@Test public void testGet() { int n = 100; Random rng = RandomUtils.getRandom(); for (int nloop = 0; nloop < n; nloop++) { int tp = rng.nextInt(1000); int tn = rng.nextInt(1000); int fp = rng.nextInt(1000); int fn = rng.nextInt(1000); CDFitness fitness = new CDFitness(tp, fp, tn, fn); double se = ((double) tp) / (tp + fn); double sp = ((double) tn) / (tn + fp); assertEquals(se * sp, fitness.get(), EPSILON); } }
@Test public void testGet() { int n = 100; Random rng = RandomUtils.getRandom(); for (int nloop = 0; nloop < n; nloop++) { int tp = rng.nextInt(1000); int tn = rng.nextInt(1000); int fp = rng.nextInt(1000); int fn = rng.nextInt(1000); CDFitness fitness = new CDFitness(tp, fp, tn, fn); double se = (double) tp / (tp + fn); double sp = (double) tn / (tn + fp); assertEquals(se * sp, fitness.get(), EPSILON); } }