MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testCdf

Method testCdf

JSAT/test/jsat/distributions/discrete/PoissonTest.java:98–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96 }
97
98 @Test
99 public void testCdf()
100 {
101 System.out.println("cdf");
102 Poisson instance = new Poisson(7);
103
104 double[] expected_7 = new double[]
105 {
106 0.000911881965554516,0.00729505572443613,0.0296361638805218,0.0817654162447216,0.172991607882071,0.300708276174361,0.449711055848699,0.598713835523037,0.729091267738082,0.830495937238673,0.901479205889087
107 };
108
109 for(int i = 0; i < expected_7.length; i++)
110 {
111 assertEquals(expected_7[i], instance.cdf(testVals[i]), 1e-4);
112
113 //its hard to get the right value for the probabilities right on the line, so lets nudge them a little to make sure we map to the right spot
114 double val;
115 if(i == 0)
116 val = instance.invCdf(expected_7[i]*.99);
117 else
118 val = instance.invCdf(expected_7[i-1]+(expected_7[i]-expected_7[i-1])*0.95);
119
120 double expected = testVals[i] >= instance.max() ? instance.max() : testVals[i];
121 assertEquals(expected, val, 1e-3);
122 }
123 }
124
125 @Test
126 public void testSummaryStats()

Callers

nothing calls this directly

Calls 3

cdfMethod · 0.95
maxMethod · 0.95
invCdfMethod · 0.45

Tested by

no test coverage detected