Examples of PT


Examples of org.integratedmodelling.riskwiz.pt.PT

    private static PT contDetFtoPT(BNNode node, BeliefNetwork bn)
        throws Exception {
        IFunction detf = node.getFunction();
        DiscretizationDomainMap dmap = new DiscretizationDomainMap(
                detf.getParentsDomains(), bn);
        PT pt = new PT(dmap.getDiscretizedParentDomains());

        int[] productStructureIterator = pt.index2addr(0);
        boolean done = false;

        while (!done) {
            setOneOutputDTValue(node, productStructureIterator, pt, detf, dmap);
            done = pt.addOne(productStructureIterator);
        }
        return pt;
    }
View Full Code Here

Examples of org.integratedmodelling.riskwiz.pt.PT

            node1 = network.getBeliefNode("Cloudy");
     
            // alternative way to set observation, it should work for more general
            // situation where evidence is not just observation but a probability distribution
            PT de = TableFactory.createObservation(node1.getDiscretizedDomain(),
                    "false");

            // normally this is better to use   for seting evidence, there is easy way with observations
            inference.setEvidence("Cloudy", de);
            inference.run();
            Set<BNNode> nodes = network.vertexSet();

            for (BNNode node : nodes) {
                System.out.println(
                        node.getName() + ":\n" + node.getMarginal().toString()
                        + "\n");
            }
     
            PT de1 = TableFactory.createObservation(node1.getDiscretizedDomain(),
                    "false");

            // normally this is better to use   for seting evidence, there is easy way with observations
            inference.setEvidence("Cloudy", de1);
            inference.run();
View Full Code Here

Examples of org.integratedmodelling.riskwiz.pt.PT

    private void updateMarginals() {
        for (int i = 0; i < orderedNodes.size(); i++) {
            BNNode node = orderedNodes.elementAt(i);

            if (!node.hasEvidence()) {
                PT marginal = new PT(
                        DomainFactory.createDomainProduct(
                                node.getDiscretizedDomain()));
                double[] counter = node.getSamplesCounter();

                for (int j = 0; j < counter.length; j++) {
                    double val = counter[j];

                    marginal.setValue(j, val);
                }
                marginal.normalize();
                node.setMarginal(marginal);
            }
        }
    }
View Full Code Here

Examples of org.integratedmodelling.riskwiz.pt.PT

    }

    // TODO how in the hell I get exact one and does it have to be exact?
    // what getProbability() really mean in this code?
    public int getEvidence(BNNode node) {
        PT pt = node.getEvidence();

        for (int i = 0; i < pt.size(); i++) {
            if (pt.getValue(i) == 1) {
                return i;
            }
        }
        return -1;
   
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.