Package edu.cmu.sphinx.linguist.acoustic.tiedstate

Examples of edu.cmu.sphinx.linguist.acoustic.tiedstate.MixtureComponent


        float resolution = 0.1f;

        float mean = 20;
        float var = 3;

        MixtureComponent gaussian = new MixtureComponent(new float[]{mean}, new float[]{var});

        for (float curX = minX; curX <= maxX; curX += resolution) {
            double gauLogScore = gaussian.getScore(new FloatData(new float[]{curX}, 16000, 0));

            double manualScore = (1 / sqrt(var * 2 * PI)) * exp((-0.5 / var) * (curX - mean) * (curX - mean));
            double gauScore = LogMath.getLogMath().logToLinear((float) gauLogScore);

            Assert.assertEquals(manualScore, gauScore, 1E-5);
View Full Code Here


    @Test
    public void testUnivariateMeanTransformation() {
        float mean = 20;
        float var = 0.001f;

        MixtureComponent gaussian = new MixtureComponent(new float[]{mean}, new float[][]{{2}}, new float[]{5}, new float[]{var}, null, null);
        Assert.assertTrue(LogMath.getLogMath().logToLinear(gaussian.getScore(new float[]{2 * mean + 5})) > 10);
    }
View Full Code Here


    /** Tests whether a <code>MixtureComponent</code>s can be cloned (using deep copying). */
    @Test
    public void testClone() throws CloneNotSupportedException {
        MixtureComponent gaussian = new MixtureComponent(new float[]{2}, new float[][]{{3}}, new float[]{4}, new float[]{5}, new float[][]{{6}}, new float[]{7});

        MixtureComponent clonedGaussian = gaussian.clone();

        Assert.assertTrue(!clonedGaussian.equals(gaussian));

        Assert.assertTrue(gaussian.getMean() != clonedGaussian.getMean());
        Assert.assertTrue(gaussian.getVariance() != clonedGaussian.getVariance());
        Assert.assertTrue(gaussian.getScore(new float[]{2}) == clonedGaussian.getScore(new float[]{2}));
    }
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.linguist.acoustic.tiedstate.MixtureComponent

Copyright © 2018 www.massapicom. 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.