@Test public void testTwoComponents() { Vector mean1 = VectorUtils.of(1., 2.); DenseMatrix covariance1 = MatrixUtil.fromList(Arrays.asList( VectorUtils.of(1, -0.25), VectorUtils.of(-0.25, 1)), true ); Vector mean2 = VectorUtils.of(2., 1.); DenseMatrix covariance2 = MatrixUtil.fromList(Arrays.asList( VectorUtils.of(1, 0.5), VectorUtils.of(0.5, 1)), true ); GmmModel gmm = new GmmModel( VectorUtils.of(0.5, 0.5), Arrays.asList( new MultivariateGaussianDistribution(mean1, covariance1), new MultivariateGaussianDistribution(mean2, covariance2) ) ); Assert.assertEquals(0., gmm.predict(mean1), 0.01); Assert.assertEquals(1., gmm.predict(mean2), 0.01); Assert.assertEquals(0., gmm.predict(VectorUtils.of(1.5, 1.5)), 0.01); Assert.assertEquals(1., gmm.predict(VectorUtils.of(3., 0.)), 0.01); }
@Override public Double predict(Vector input) { return (double)likelihood(input).maxElement().index(); }
GmmModel extends DistributionMixture<MultivariateGaussianDistribution> implements IgniteModel<Vector, Double>,
    DeployableObject { @Override public Double predict(Vector input) { return (double)likelihood(input).maxElement().index(); } }
GmmModel extends DistributionMixture<MultivariateGaussianDistribution> implements IgniteModel<Vector, Double>,
    DeployableObject { @Override public Double predict(Vector input) { return (double)likelihood(input).maxElement().index(); } GmmModel(Vector componentProbs, List<MultivariateGaussianDistribution> distributions); }
GmmModel extends DistributionMixture<MultivariateGaussianDistribution> implements IgniteModel<Vector, Double>,
    DeployableObject { @Override public Double predict(Vector input) { return (double)likelihood(input).maxElement().index(); } GmmModel(Vector componentProbs, List<MultivariateGaussianDistribution> distributions); @Override Double predict(Vector input); @Override List<Object> getDependencies(); }
GmmModel extends DistributionMixture<MultivariateGaussianDistribution> implements IgniteModel<Vector, Double>,
    DeployableObject { @Override public Double predict(Vector input) { return (double)likelihood(input).maxElement().index(); } GmmModel(Vector componentProbs, List<MultivariateGaussianDistribution> distributions); @Override Double predict(Vector input); @Override List<Object> getDependencies();  }