Examples of DiagonalNormalDistribution


Examples of com.enterprisemath.math.probability.DiagonalNormalDistribution

            // find the maximum weight
            double splitValue = 0;
            int splitCompIdx = 0;
            int splitDimIdx = 0;
            for (int i = 0; i < res.getNumComponents(); ++i) {
                DiagonalNormalDistribution comp = res.getComponents().get(i);
                for (int j = 0; j < comp.getDimension(); ++j) {
                    if (res.getWeights().get(i) * res.getComponents().get(i).getSigma().getComponent(j) > splitValue) {
                        splitValue = res.getWeights().get(i) * res.getComponents().get(i).getSigma().getComponent(j);
                        splitCompIdx = i;
                        splitDimIdx = j;
                    }
                }
            }
            // split the component with highest weight
            DiagonalNormalDistributionMixture.Builder builder = new DiagonalNormalDistributionMixture.Builder();
            for (int i = 0; i < res.getNumComponents(); ++i) {
                if (i == splitCompIdx) {
                    DiagonalNormalDistribution comp = res.getComponents().get(i);
                    double[] mi1 = new double[res.getDimension()];
                    double[] mi2 = new double[res.getDimension()];
                    for (int j = 0; j < comp.getDimension(); ++j) {
                        if (j == splitDimIdx) {
                            mi1[j] = comp.getMi().getComponent(j) + comp.getSigma().getComponent(j) / 2;
                            mi2[j] = comp.getMi().getComponent(j) - comp.getSigma().getComponent(j) / 2;
                        }
                        else {
                            mi1[j] = comp.getMi().getComponent(j);
                            mi2[j] = comp.getMi().getComponent(j);
                        }
                    }
                    builder.addComponent(res.getWeights().get(i) / 2, Vector.create(mi1), comp.getSigma());
                    builder.addComponent(res.getWeights().get(i) / 2, Vector.create(mi2), comp.getSigma());
                }
                else {
                    if (res.getWeights().get(i) >= minWeight) {
                        builder.addComponent(res.getWeights().get(i), res.getComponents().get(i));
                    }
View Full Code Here

Examples of com.enterprisemath.math.probability.DiagonalNormalDistribution

            // find the maximum weight
            double splitValue = 0;
            int splitCompIdx = 0;
            int splitDimIdx = 0;
            for (int i = 0; i < res.getNumComponents(); ++i) {
                DiagonalNormalDistribution comp = res.getComponents().get(i);
                for (int j = 0; j < comp.getDimension(); ++j) {
                    if (res.getWeights().get(i) * res.getComponents().get(i).getSigma().getComponent(j) > splitValue) {
                        splitValue = res.getWeights().get(i) * res.getComponents().get(i).getSigma().getComponent(j);
                        splitCompIdx = i;
                        splitDimIdx = j;
                    }
                }
            }
            // split the component with highest weight
            DiagonalNormalDistributionMixture.Builder builder = new DiagonalNormalDistributionMixture.Builder();
            for (int i = 0; i < res.getNumComponents(); ++i) {
                if (i == splitCompIdx) {
                    DiagonalNormalDistribution comp = res.getComponents().get(i);
                    double[] mi1 = new double[res.getDimension()];
                    double[] mi2 = new double[res.getDimension()];
                    for (int j = 0; j < comp.getDimension(); ++j) {
                        if (j == splitDimIdx) {
                            mi1[j] = comp.getMi().getComponent(j) + comp.getSigma().getComponent(j) / 2;
                            mi2[j] = comp.getMi().getComponent(j) - comp.getSigma().getComponent(j) / 2;
                        }
                        else {
                            mi1[j] = comp.getMi().getComponent(j);
                            mi2[j] = comp.getMi().getComponent(j);
                        }
                    }
                    builder.addComponent(res.getWeights().get(i) / 2, Vector.create(mi1), comp.getSigma());
                    builder.addComponent(res.getWeights().get(i) / 2, Vector.create(mi2), comp.getSigma());
                }
                else {
                    if (res.getWeights().get(i) >= minWeight) {
                        builder.addComponent(res.getWeights().get(i), res.getComponents().get(i));
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.