Package edu.gmu.seor.prognos.unbbayesplugin.cps.datastructure

Examples of edu.gmu.seor.prognos.unbbayesplugin.cps.datastructure.EDBUnit


  
  /**
   * Initialize the likelihood weighting.
   */
  public void initLikelihoodWeighting(){
    EDBUnit nodes = EDB.This().get("ROOT.ENGINES.LW.NODES");
    EDBUnit ISA = nodes.getRel("ISA")
    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 states = node.get("STATES");
      EDBUnit bel = node.get("BEL");
     
      if( type.getData().equalsIgnoreCase("Discrete") ){
        bel.copy2(states);
      }else
      if( type.getData().equalsIgnoreCase("Continuous") ){
      }
      
    }
View Full Code Here


   * @param cptLast the cpt last
   * @param mapSample the map sample
   * @return the string
   */
  public String samplingFromCPT( EDBUnit cptLast, Map<String, String> mapSample ){ 
    EDBUnit lastIsa = cptLast.getRel("ISA");
    if(lastIsa != null && lastIsa.map.size() != 0 ){
      for( String str : lastIsa.map.keySet() ){
        EDBUnit t = lastIsa.map.get(str);   
        //t.print("");
        String strState = mapSample.get(t.getData());
        if( strState != null && strState.equalsIgnoreCase(t.getName()) )       
          return samplingFromCPT(t, mapSample);
      }
    }
    else{  
      return sampling(cptLast);
View Full Code Here

  public Double getProbFromEquation( EDBUnit cpt, EDBUnit eqList,  Map<String, String> mapSample, Double evidence  ){
    //getEquation( eqList, mapSample );
    ArrayList<DiscreteNodesCombination> listDiscreteNodeCombination = new ArrayList<DiscreteNodesCombination>();
    get_DiscreteNode_combination(cpt, listDiscreteNodeCombination, eqList );
       
    EDBUnit eq = null;
    for( DiscreteNodesCombination dc: listDiscreteNodeCombination){
      if( dc.have( mapSample )) {
        eq = dc.getEquation();
      }
    }
View Full Code Here

    Double dParameter1 = Double.NaN;
    Double dParameter2 = Double.NaN;
      
    //iteration 
    int i = 0;
    EDBUnit ISA = eq.getRel("ISA");
    if( ISA != null )
    for( String str : ISA.getMap().keySet() ){
      EDBUnit child = ISA.map.get(str);
     
      if( i == 0 )
        dParameter1 = getMeanAndSTD( i, child, mapSample )
      else
        dParameter2 = getMeanAndSTD( i, child, mapSample )
View Full Code Here

  public Double samplingFromEquation( EDBUnit cpt, EDBUnit eqList,  Map<String, String> mapSample  ){
    //getEquation( eqList, mapSample );
    ArrayList<DiscreteNodesCombination> listDiscreteNodeCombination = new ArrayList<DiscreteNodesCombination>();
    get_DiscreteNode_combination(cpt, listDiscreteNodeCombination, eqList );
       
    EDBUnit eq = null;
    for( DiscreteNodesCombination dc: listDiscreteNodeCombination){
      if( dc.have( mapSample )) {
        eq = dc.getEquation();
      }
    }
View Full Code Here

    Double dParameter1 = Double.NaN;
    Double dParameter2 = Double.NaN;
      
    //iteration 
    int i = 0;
    EDBUnit ISA = eq.getRel("ISA");
    if( ISA != null )
    for( String str : ISA.getMap().keySet() ){
      EDBUnit child = ISA.map.get(str);
     
      if( i == 0 )
        dParameter1 = sampling( i, child, mapSample )
      else
        dParameter2 = sampling( i, child, mapSample )
View Full Code Here

    Map<String, String> mapSample = new HashMap<String, String>();
    sampleList.add(mapSample);
    Double lw = 1.0;
   
      //showing result
    EDBUnit nodes = EDB.This().get("ROOT.ENGINES.LW.NODES");
    EDBUnit ISA = nodes.getRel("ISA")
    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");
       
      //System.out.println(" " + str + ":");
     
      //node.print("node ");
      //if this node is an evidence node
      if( evidence != null ){
        if( type.getData().equalsIgnoreCase("Discrete") ){
          EDBUnit state = cpt.getNext(evidence.getData());
          lw *= state.getDataByDouble();
          mapSample.put( str, evidence.getData() );
        }else
        if( type.getData().equalsIgnoreCase("Continuous") ){
          mapSample.put( str, evidence.getData() );
          lw *= getProbFromEquation( cpt, eq, mapSample, evidence.getDataByDouble() );
        }
      }
      else //if this node is not an evidence node
      if( type.getData().equalsIgnoreCase("Discrete") ){
               
        EDBUnit isa = cpt.getRel("ISA");
       
        //this node doesn't have parents
        if( isa == null ){
          String strState = sampling(cpt);
          mapSample.put(str, strState);
        }else  //this node has parents
          {
          String strState = samplingFromCPT(cpt, mapSample);
          mapSample.put(str, strState);
        }
      }else
      if( type.getData().equalsIgnoreCase("Continuous") ){
        EDBUnit isa = cpt.getRel("ISA");
        //this node doesn't have parents
        if( isa == null ){
          Double d = sampling( 0, eq, mapSample  );
          mapSample.put(str, d.toString());
        }else  //this node has parents
View Full Code Here

        }
      }
    }
   
  //  System.out.println("mean " + mean + " var " + var);
    EDBUnit mu = bel.create("MU");
    EDBUnit sigma = bel.create("SIGMA");
    mu.setData(mean.toString());
    sigma.setData(var.toString());
  }
View Full Code Here

    Double totalLW = 0.0;
    for( int i = 0; i < lwList.size(); i++ )
      totalLW += lwList.get(i);
     
    //step 3. getting marginal
    EDBUnit nodes = EDB.This().get("ROOT.ENGINES.LW.NODES");
    EDBUnit ISA = nodes.getRel("ISA")
    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");
      
    //  node.print("node ");
      //if this node is an evidence node
      if( evidence == null ){
        if( type.getData().equalsIgnoreCase("Discrete") ){
          marginalDiscrete(str, bel.getNext(), totalLW);
        }else
        if( type.getData().equalsIgnoreCase("Continuous") ){
          marginalContinuous(str, bel, totalLW);
        }
      }
View Full Code Here

   
    if( getName().equalsIgnoreCase("E")){
      GMMEvidenceDlg d = new GMMEvidenceDlg();
        String s = d.showInputDialog("Set evidence");
        if( s != null ){
          EDBUnit node = EDB.This().get("ROOT.NODES." + gmmNode.getNode().getName());
          EDBUnit Evidence = node.create("EVIDENCE");
          Evidence.setData(s);
          gmmNode.update();
        }
    }
  }
View Full Code Here

TOP

Related Classes of edu.gmu.seor.prognos.unbbayesplugin.cps.datastructure.EDBUnit

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.