@Test public void testP() { System.out.println("p"); GaussianDistribution instance = new GaussianDistribution(4.0, 3.0); instance.rand(); assertEquals(2.482015e-06, instance.p(-10), 1E-10); assertEquals(0.01799699, instance.p(-2), 1E-7); assertEquals(0.1064827, instance.p(2), 1E-7); assertEquals(0.1257944, instance.p(3), 1E-7); assertEquals(0.1329808, instance.p(4), 1E-7); assertEquals(0.1257944, instance.p(5), 1E-7); assertEquals(0.1064827, instance.p(6), 1E-7); assertEquals(0.0806569, instance.p(7), 1E-7); assertEquals(0.01799699, instance.p(10), 1E-7); assertEquals(8.85434e-08, instance.p(20), 1E-12); }
@Override public double p(double x) { if (sigma == 0) { if (x == mu) { return 1.0; } else { return 0.0; } } return Math.exp(logp(x)); }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double p(double x) { if (sigma == 0) { if (x == mu) { return 1.0; } else { return 0.0; } } return Math.exp(logp(x)); } }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double p(double x) { if (sigma == 0) { if (x == mu) { return 1.0; } else { return 0.0; } } return Math.exp(logp(x)); } GaussianDistribution(double mu, double sigma); }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double p(double x) { if (sigma == 0) { if (x == mu) { return 1.0; } else { return 0.0; } } return Math.exp(logp(x)); } GaussianDistribution(double mu, double sigma); static GaussianDistribution fit(double[] data); static GaussianDistribution getInstance(); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @Override double entropy(); @Override String toString(); @Override double rand(); double randInverseCDF(); @Override double p(double x); @Override double logp(double x); @Override double cdf(double x); @Override double quantile(double p); @Override Mixture.Component M(double[] x, double[] posteriori); }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double p(double x) { if (sigma == 0) { if (x == mu) { return 1.0; } else { return 0.0; } } return Math.exp(logp(x)); } GaussianDistribution(double mu, double sigma); static GaussianDistribution fit(double[] data); static GaussianDistribution getInstance(); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @Override double entropy(); @Override String toString(); @Override double rand(); double randInverseCDF(); @Override double p(double x); @Override double logp(double x); @Override double cdf(double x); @Override double quantile(double p); @Override Mixture.Component M(double[] x, double[] posteriori); final double mu; final double sigma; }