Package unbbayes.prs.bn

Examples of unbbayes.prs.bn.ProbabilisticNetwork


  {
    // change default locale
    Locale.setDefault(new Locale("en"));
    
    File ASIA_FILE = new File("src/test/resources/testCases/cpslTest.net");
    ProbabilisticNetwork net;
    BaseIO io = new NetIO();
      try {
        net = (ProbabilisticNetwork)io.load(ASIA_FILE);
        ProbabilisticNode n = (ProbabilisticNode)net.getNode("B");
        CPSController w = new CPSController( n );
      } catch (LoadException e) {
        e.printStackTrace();
      } catch (IOException e) {
    }
View Full Code Here


//    mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("T0", mebn.getObjectEntityContainer().getObjectEntityByName("TimeStep")));
//    mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("T1", mebn.getObjectEntityContainer().getObjectEntityByName("TimeStep")));
    mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("T2", mebn.getObjectEntityContainer().getObjectEntityByName("TimeStep")));
   
   
    probabilisticNetwork = new ProbabilisticNetwork(mebn.getName());
    SSBN ssbn = new SSBN();
    ssbn.setNetwork(probabilisticNetwork);
   
    speedOBJ1T2 = new ProbabilisticNode();
    speedOBJ1T2.setName(residentSpeed.getName() + "_OBJ1_T2");
View Full Code Here

    }
  
  }
 
  public ProbabilisticNetwork loadNetworkFile(File file){
    ProbabilisticNetwork pn = new ProbabilisticNetwork("");
      XMLBIFIO netIO = new XMLBIFIO();
     
      try {
      netIO.loadXML(file, pn) ;
    } catch (LoadException e) {
View Full Code Here

    }
  
  }
 
  public ProbabilisticNetwork loadNetworkFile(File file){
    ProbabilisticNetwork pn = new ProbabilisticNetwork("");
      XMLBIFIO netIO = new XMLBIFIO();
     
      try {
      netIO.loadXML(file, pn) ;
    } catch (LoadException e) {
View Full Code Here

  /**
   * Test method for {@link unbbayes.prs.mebn.ssbn.laskeyalgorithm.LaskeySSBNGenerator#generateSSBN(java.util.List, unbbayes.prs.mebn.kb.KnowledgeBase)}.
   */
  public final void testQueryResidentNode() {
    ProbabilisticNetwork net = null;
    try {
      String[] queryParam = new String[1];
      queryParam[0] = "Obj1";
      net = textModeRunner.callLaskeyAlgorithm(mebn, knowledgeBase, "ObjectType", queryParam);
     
      // do something to net if you want to do so
     
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
    assertNotNull(net);
    assertTrue(net.getNodeCount() > 0);
  }
View Full Code Here

  /**
   * Test method for {@link unbbayes.prs.mebn.ssbn.laskeyalgorithm.LaskeySSBNGenerator#generateSSBN(java.util.List, unbbayes.prs.mebn.kb.KnowledgeBase)}.
   * For a continuous node
   */
  public final void testQueryContinuousNode() {
    ProbabilisticNetwork net = null;
    try {
      String[] queryParam = new String[2];
      queryParam[0] = "Rpt1";
      queryParam[1] = "T0";
      net = textModeRunner.callLaskeyAlgorithm(mebn, knowledgeBase, "MTI", queryParam);
     
      // do something to net if you want to do so
     
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
    assertNotNull(net);
    assertTrue(net.getNodeCount() > 0);
  }
View Full Code Here

   *
   * @param nodes the nodes
   * @return the probabilistic network
   */
  public ProbabilisticNetwork convert(EDBUnit nodes){
    ProbabilisticNetwork pn = new ProbabilisticNetwork("New Network");
 
    //step 1. create new uNodes from sNodes 
    EDBUnit ISA = nodes.getRel("ISA");
    for( String str : ISA.getMap().keySet() ){
      EDBUnit node = ISA.map.get(str);
      createUDBfromSDB( pn, node );
    }
     
    //step 2. create new edges between sNodes 
    for( String str : ISA.getMap().keySet() ){
      EDBUnit node = ISA.map.get(str);
      EDBUnit parents = node.get("PARENTS");
      createEdgeOfUDB( pn, node, parents.getNext() );
    }
   
    //step 3. set states 
    for( String str : ISA.getMap().keySet() ){
      EDBUnit node = ISA.map.get(str);
      setStatesOfUDB( pn, node );
    }
   
    //step 4. set Marginal 
    for( String str : ISA.getMap().keySet() ){
      EDBUnit node = ISA.map.get(str);
      setMarginalStatesOfUDB( pn, node );
    }
   
    //step 5. set evidences
     for( String str : ISA.getMap().keySet() ){
      EDBUnit node = ISA.map.get(str);
      EDBUnit type = node.get("INFO.TYPE");
      EDBUnit description = node.get("INFO.DESCRIPTION");
      EDBUnit evidence = node.get("EVIDENCE");
      EDBUnit parents = node.get("PARENTS");
      EDBUnit children = node.get("CHILDREN");
      EDBUnit cpt = node.getCopied("CPT");
      EDBUnit eq = node.getCopied("EQUATION");
      EDBUnit bel = node.get("BEL")
      
      if( evidence != null ){
        evidence.print("evidence:");
        if( type.getData().equalsIgnoreCase("Discrete") ){
          ProbabilisticNode uNode = (ProbabilisticNode)pn.getNode(node.getName());
          for (int i = 0; i < uNode.getStatesSize(); i++) {
            if(uNode.getStateAt(i).equalsIgnoreCase(evidence.getData())){
              uNode.addFinding(i);
              break;
            }
          }
        }else
        if( type.getData().equalsIgnoreCase("Continuous") ){
          GmmNodePluginStub gmmNode = (GmmNodePluginStub)pn.getNode(node.getName());
          gmmNode.updateGMMData();
        }
      } 
     }
     
View Full Code Here

TOP

Related Classes of unbbayes.prs.bn.ProbabilisticNetwork

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.