@Test public void testLikelihood() { assertArrayEquals( new double[] {0.15, 0.3, 0.}, mixture.likelihood(VectorUtils.of(1.)).asArray(), 1e-4 ); }
public Vector likelihood(Vector x) { return VectorUtils.of(distributions.stream().mapToDouble(f -> f.prob(x)).toArray()) .times(componentProbs); }
DistributionMixture implements Distribution { public Vector likelihood(Vector x) { return VectorUtils.of(distributions.stream().mapToDouble(f -> f.prob(x)).toArray()) .times(componentProbs); } }
DistributionMixture implements Distribution { public Vector likelihood(Vector x) { return VectorUtils.of(distributions.stream().mapToDouble(f -> f.prob(x)).toArray()) .times(componentProbs); } DistributionMixture(Vector componentProbs, List<C> distributions); }
DistributionMixture implements Distribution { public Vector likelihood(Vector x) { return VectorUtils.of(distributions.stream().mapToDouble(f -> f.prob(x)).toArray()) .times(componentProbs); } DistributionMixture(Vector componentProbs, List<C> distributions); @Override double prob(Vector x); Vector likelihood(Vector x); int countOfComponents(); Vector componentsProbs(); List<C> distributions(); @Override int dimension(); }
DistributionMixture implements Distribution { public Vector likelihood(Vector x) { return VectorUtils.of(distributions.stream().mapToDouble(f -> f.prob(x)).toArray()) .times(componentProbs); } DistributionMixture(Vector componentProbs, List<C> distributions); @Override double prob(Vector x); Vector likelihood(Vector x); int countOfComponents(); Vector componentsProbs(); List<C> distributions(); @Override int dimension();  }