Package edu.brown.mappings

Examples of edu.brown.mappings.PearsonCorrelationMapping.calculate()


    public void testAbsoluteNegative() {
        PearsonCorrelationMapping p = new PearsonCorrelationMapping();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(i, -i);
        }
        assertEquals(-1.0d, roundToDecimals(p.calculate(), 1));
    }
   
    /**
     * testRandomCorrelation
     */
 
View Full Code Here


    public void testRandomCorrelation() {
        PearsonCorrelationMapping p = new PearsonCorrelationMapping();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(i, (this.rand.nextDouble() - 0.5) * i);
        }
        assertTrue(Math.abs(p.calculate()) < 0.1);
    }

    /**
     * testPositiveCorrelation
     */
 
View Full Code Here

    public void testPositiveCorrelation() {
        PearsonCorrelationMapping p = new PearsonCorrelationMapping();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(i, (this.rand.nextDouble()) * i);
        }
        assertTrue(Math.abs(p.calculate()) > 0.4);
    }
  
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.