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

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


   
    sumCPT(cptLast);
   
    for( String str : tempValueMap.keySet() ){
      Double d = tempValueMap.get(str);
      EDBUnit n = dest.createNext(str);
      n.setData(d.toString());
    }
     
    tempValueMap.clear();
    tempValueMap = null;
  }
View Full Code Here


   
    sumCPT(cptLast);
   
    for( String str : tempValueMap.keySet() ){
      Double d = tempValueMap.get(str);
      EDBUnit n = dest.createNext(str);
      n.setData(d.toString());
    }
   
    normalizeVector(dest);
   
    tempValueMap.clear();
View Full Code Here

   * Sum cpt.
   *
   * @param cptLast the cpt last
   */
  public void sumCPT( EDBUnit cptLast ){ 
    EDBUnit lastIsa = cptLast.getRel("ISA");
    
    if(lastIsa != null && lastIsa.map.size() != 0 ){
      for( String str : lastIsa.map.keySet() ){
        EDBUnit t = lastIsa.map.get(str);  
        sumCPT(t);
      }
    }
    else{   
      sumCPTNext(cptLast.getNext());    
View Full Code Here

   * @param cpt the cpt
   * @param e the e
   * @return the eDB unit
   */
  public EDBUnit marginalizeCPT( EDBUnit cpt, EDBUnit e ){
    EDBUnit ret = null;
   
    tempValueMap = new HashMap<String, Double>();
    tempValueNameArray = new ArrayList<String>();
   
    if( e == null ){
      ret = new EDBUnit();
      ret.setName(cpt.getName());
      initMarginalizationForCPT(cpt);
    }else{
      setNextStateForMarginalization(e.getNext());
      ret = new EDBUnit();
      ret.setName(e.getName())
    }
   
    doMarginalization(cpt, ret, null);
   
    //getting sum of the result marginalized
    //EX) true 1, false 1 - > sum 2
    double sum = 0.0;
    for (String s: tempValueMap.keySet()){
      sum += tempValueMap.get(s);
    }
   
    //normalizing and setting the result marginalized and normalized.
    for( int i = 0; i < tempValueNameArray.size(); i++){
      String str = tempValueNameArray.get(i);
      Double d = tempValueMap.get(str)/sum;
      EDBUnit n = ret.createNext(str);
      n.setData(d.toString());
    }
   
    //ret.print("marginalizeCPT.ret3 ");
    
    tempValueMap.clear();
View Full Code Here

   * Initialize the marginalization for cpt.
   *
   * @param cptLast the cpt last
   */
  public void initMarginalizationForCPT( EDBUnit cptLast ){ 
    EDBUnit lastIsa = cptLast.getRel("ISA");
    
    if(lastIsa != null && lastIsa.map.size() != 0 ){
      for( String str : lastIsa.map.keySet() ){
        EDBUnit t = lastIsa.map.get(str);  
        
        initMarginalizationForCPT(t);
      }
    }
    else{   
View Full Code Here

   * @param cptLast the cpt last
   * @param ret the return
   * @param retStr the return string
   */
  public void doMarginalization( EDBUnit cptLast, EDBUnit ret, String retStr ){ 
    EDBUnit lastIsa = cptLast.getRel("ISA");
    
    if(lastIsa != null && lastIsa.map.size() != 0 ){
      for( String str : lastIsa.map.keySet() ){
        EDBUnit t = lastIsa.map.get(str)
   
        if( t.getData().equalsIgnoreCase(ret.getName()) ){
          Double d = tempValueMap.get(str);
          if( d != null ){
            retStr = str;
          }
        }
View Full Code Here

      "else if( a1 && b2 ) { C1:0.9; C2:0.1;} "  +
      "else if( a2 && b1 ) { C1:0.7; C2:0.3;} "  +
      "else if( a2 && b2 ) { C1:0.5; C2:0.5;} }" 
    );
   
    EDBUnit cpt = EDB.This().get("ROOT.NODES.C.CPT");
    EDBUnit cpt2 = new EDBUnit(cpt);
    EDBUnit states = EDB.This().get("ROOT.NODES.A.STATES");
    EDBUnit statesA = new EDBUnit(states);
    statesA.setName("A");
    EDBUnit statesB = EDB.This().get("ROOT.NODES.B.STATES");
    statesB.setName("B");
   
    cpt2.print("");
    //statesA.print("");
   
    CPTOperator.This().doToCPT( OPERATOR.DOT_MULTIPLY, cpt2, statesA );
    cpt2.print(".* ");
   
    CPTOperator.This().doToCPT( OPERATOR.DOT_NORMALIZE, cpt2 );   
    cpt2.print("normalized ");
       
       
    CPTOperator.This().doToVector( OPERATOR.DOT_MULTIPLY, states, statesA );   
    states.print(".* ");
   
    CPTOperator.This().normalizeVector(states);   
    states.print("normalized ");
   
    CPTOperator.This().normalizeCPT(cpt2, states);
    states.print("nomalized CPT ");
   
    cpt2.print("CPT ");
    statesB.print("states2 ");
    EDBUnit ret = CPTOperator.This().marginalizeCPT(cpt2, statesB);
    ret.print("marginalizeCPT ");
  }
View Full Code Here

  /**
   * Instantiates a new discrete nodes combination.
   */
  public DiscreteNodesCombination() {
    mapValuesForAssingnment = new HashMap<String, String>();
    EQ = new EDBUnit("EQ");
  }
View Full Code Here

          "{ defineState(Continuous);" +
          "p( E | X ) =  Root(R, 2) * Log( X, e ) - C; }"
        );
           
        EquationOperator e = new EquationOperator();
        EDBUnit r = e.convert( EDB.This().get("ROOT.NODES.E.EQUATION"), "X" );
        r.print("Inv ");
  }
View Full Code Here

        );
       
        EDB.This().get("ROOT.NODES.E.EQUATION").print("");
        EquationOperator e = new EquationOperator();
       
        EDBUnit r = e.convert( EDB.This().get("ROOT.NODES.E.EQUATION"), "T", "Y" );
        r.print("Inv ");
    //    String str = e.getStringFromInv(EDB.This().get("ROOT.NODES.E.EQUATION"));
   //     System.out.println(str);
  }
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.