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

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


      listVar.clear();
      listWeight.clear();
    }
    
    String strEngine = EDB.This().get("ROOT.NET_INFO.CURRENT_ENGINE").getData();
    EDBUnit node = EDB.This().get("ROOT.ENGINES." + strEngine + ".NODES." + getNode().getName());
    EDBUnit BEL = node.get("BEL");
    EDBUnit PI = node.get("MSG.PI." + getNode().getName());
    EDBUnit EVIDENCE = node.get("EVIDENCE");
    EDBUnit EVIDENCE2 = EDB.This().get("ROOT.NODES." + node.getName() +".EVIDENCE");
    
    if( EVIDENCE != null && EVIDENCE.hasChildren() ){
      gEvidence = EVIDENCE.getDataByDouble();
      hasEvidence = true;  
    //  this.addFinding(0);
    }else
    if( EVIDENCE2 != null && EVIDENCE2.hasChildren() ){
      gEvidence = EVIDENCE2.getDataByDouble();
      hasEvidence = true;
    //  this.addFinding(0);
    }else{
      this.resetEvidence();
      gEvidence = 0.0;
      hasEvidence = false;
    }
    if( BEL!= null && hasEvidence == false ){
      if( PI.get("MU").getMatrix().getColumnDimension() == 1){
        if( BEL.get("MU") != null && BEL.get("SIGMA") != null ){
          gMean = BEL.get("MU").getMatrixData();
          gVar = BEL.get("SIGMA").getMatrixData();
          addGMMData( gMean, gVar, 1.0 );
        }else{
          gMean = PI.get("MU").getMatrixData();
          gVar = PI.get("SIGMA").getMatrixData();
          addGMMData( gMean, gVar, 1.0 );
        }
      }
      else{
        EDBUnit gm_bel = node.get("GM_BEL");
        if (gm_bel != null ){
          for( int i = 0; i < gm_bel.get("MU").getMatrix().getColumnDimension(); i++ ){
            addGMMData( gm_bel.get("MU").getMatrix().get(0,i), gm_bel.get("SIGMA").getMatrix().get(0,i), gm_bel.get("GMMPRIOR").getMatrix().get(0,i));
           }
       
          if( BEL.get("MU") != null gMean = BEL.get("MU").getMatrixData();
          if( BEL.get("SIGMA") != null gVar = BEL.get("SIGMA").getMatrixData();
        }
View Full Code Here


 
  private void printPMC_FinalResult(Node node, PMCPotentialTable res) {
    System.out.println("variable list "+res.getVariableList());
    System.out.println("Continuous node list "+res.getContinuousNodeList());
   
    EDBUnit SNode = EDB.This().get("ROOT.ENGINES.JT.NODES."+node.getName());
    EDBUnit bel = SNode.get("BEL");
   
    if (node.getType() == Node.PROBABILISTIC_NODE_TYPE) {
            
      if (res.hasNoDescreteStates) {
        System.out.println("Probability:");
        System.out.println(res.getmChar().getProbability());
        System.out.println("Mean:");
        if(res.getmChar().getMeanMatrix() != null)
          printMatrix(res.getmChar().getMeanMatrix().getMeanMatrix());
        System.out.println("Covariance:");
        if(res.getmChar().getCoVarMatrix() != null)
          printMatrix(res.getmChar().getCoVarMatrix().getCoVarMatrix());
  
        EDBUnit mu = bel.get("MU");
        EDBUnit sigma = bel.get("SIGMA");
        if( mu ==  null){
           mu = bel.create("MU");
          sigma = bel.create("SIGMA");
        }
    //    mu.setData(mean.toString());
    //    sigma.setData(var.toString());
       
      } else {
        System.out.println("Probability:");
        for (int i = 0; i < res.tableSize(); i++) {
          System.out.println(res.getJPDValue(i));
        }
        System.out.println("Mean");
        for (int i = 0; i < res.tableSize(); i++) {
          if(res.getMeanMatValue(i) != null)
            printMatrix(res.getMeanMatValue(i).getMeanMatrix());
        }
        System.out.println("Covariance");
        for (int i = 0; i < res.tableSize(); i++) {
          if(res.getCoVarMatValue(i) != null)
            printMatrix(res.getCoVarMatValue(i).getCoVarMatrix());
        }
      }
    }else{
      if (res.hasNoDescreteStates) {
        System.out.println("Probability:");
        System.out.println(res.getmChar().getProbability());
        System.out.println("Mean:");
        if(res.getmChar().getMeanMatrix() != null)
          printMatrix(res.getmChar().getMeanMatrix().getMeanMatrix());
        System.out.println("Covariance:");
        if(res.getmChar().getCoVarMatrix() != null)
          printMatrix(res.getmChar().getCoVarMatrix().getCoVarMatrix());
  
        EDBUnit mu = bel.get("MU");
        EDBUnit sigma = bel.get("SIGMA");
        if( mu ==  null){
           mu = bel.create("MU");
          sigma = bel.create("SIGMA");
        }
      //  mu.setData(mean.toString());
View Full Code Here

     
      Debug.println("new tree node "+ treeNode.toString() );
     
      //by Young 2011
      String strEngine = EDB.This().get("ROOT.NET_INFO.CURRENT_ENGINE").getData();
      EDBUnit BEL = EDB.This().get("ROOT.ENGINES." + strEngine + ".NODES." + node.getName() +".BEL");
      EDBUnit type = EDB.This().get("ROOT.ENGINES." + strEngine + ".NODES." + node.getName() +".INFO.TYPE");
      EDBUnit EVIDENCE = EDB.This().get("ROOT.ENGINES." + strEngine + ".NODES." + node.getName() +".EVIDENCE");
      EDBUnit EVIDENCE2 = EDB.This().get("ROOT.NODES." + node.getName() +".EVIDENCE");
      String label;
    
      if( EVIDENCE2 != null && EVIDENCE2.hasChildren() ){
        label = "EVIDENCE" + ": " + EVIDENCE2.getData();
        treeNode.add(new DefaultMutableTreeNode(label));
      }else if( EVIDENCE != null && EVIDENCE.hasChildren() ){
        label = "EVIDENCE" + ": " + EVIDENCE.getData();
        treeNode.add(new DefaultMutableTreeNode(label));
      }else{
View Full Code Here

            // TODO avoid usage of instanceof
            // TODO stop using static instance of DMP DB
            if ((node instanceof ContinuousNode)
                || (node instanceof GmmNodePluginStub)) {
              // findings to continuous nodes should be added directly to the DMP database.
              EDBUnit edbNode = EDB.This().get("ROOT.NODES." + node.getName());
                EDBUnit Evidence = edbNode.create("EVIDENCE");
                Evidence.setData(stateName);
            } else {
              // add discrete findings directly to the network managed by the inference algorithm
              // unfortunately, the network managed by the algorithm and the one linked to the SSBN may not be the same (because algorithm may instantiate another network)
              boolean isStateInNode = false;   // indicates if node contains the specified state (true if evidence is to a valid state)
              for(int i = 0; i < node.getStatesSize(); i++){
View Full Code Here

   * @param op the operator
   * @param cptLast the cpt last
   * @param e the e
   */
  public void doToCPTOperation( OPERATOR op, EDBUnit cptLast, EDBUnit e ){ 
    EDBUnit lastIsa = cptLast.getRel("ISA");
    
    if(lastIsa != null && lastIsa.map.size() != 0 ){
      for( String str : lastIsa.map.keySet() ){
        EDBUnit t = lastIsa.map.get(str)
       
        // System.out.println( "[" + t.getName() + "<-" + t.getData() + "]" );
       
         /*
          * "case 1"
            cptLast C.a1.b1.[DATA:B]
          cptLast C.a1.b1.[NEXT:C1][DATA:0.2]
          cptLast C.a1.b1.[NEXT:C1][NEXT:C2][DATA:0.8]
          cptLast C.a1.b2.[DATA:B]
          cptLast C.a1.b2.[NEXT:C1][DATA:0.7]
          cptLast C.a1.b2.[NEXT:C1][NEXT:C2][DATA:0.3]
          cptLast C.a1.[DATA:A]
          e A.[NEXT:a1][DATA:0.8]
          e A.[NEXT:a1][NEXT:a2][DATA:0.2]
        */
        if( e != null )
        if( e.getName().equalsIgnoreCase(t.getData()) ){
          EDBUnit v = e.getNext(t.getName());
          if( v != null ){
            tempValue = Double.valueOf(v.getData());
            //System.out.println( "Selected Vaule :" + tempValue );           
          }
        }
       
        doToCPTOperation(op, t, e);
View Full Code Here

        cptLast C.a1.b2.[NEXT:C1][NEXT:C2][DATA:0.3]
        cptLast C.a1.[DATA:A]
        e: C.[NEXT:C1][DATA:1]
        e: C.[NEXT:C1][NEXT:C2][DATA:1]
      */
      EDBUnit d = tempEUnit.getNext(last.getName());
      d2 = Double.valueOf(d.getData());
    }
    //System.out.println( last.getName() + ":" + last.getData() );
    
   
    if( op == OPERATOR.DOT_PLUS ){
View Full Code Here

   * @param op the operator
   * @param e1 the e unit 1
   * @param e2 the e unit 2
   */
  public void doToVectorOperation( OPERATOR op, EDBUnit e1, EDBUnit e2 ){ 
    EDBUnit n1 = e1.getNext();
    EDBUnit n2 = e2.getNext();

    if( n1 == null || n2 == null )
      return;
   
    doToDataOperation(op, n1, n2);
View Full Code Here

   *
   * @param op the operator
   * @param e1 the e unit 1
   */
  public void doToVectorOperation( OPERATOR op, EDBUnit e1 ){ 
    EDBUnit n1 = e1.getNext();
    
    if( n1 == null )
      return;
       
    Double d1 = Double.valueOf(n1.getData())
   
    if( op == OPERATOR.DOT_ABS ){
      d1 = Math.abs(d1);
      n1.setData(d1.toString());
    }else
    if( op == OPERATOR.DOT_SUM ){
      tempValue += d1;
    }
   
View Full Code Here

   * Normalize do.
   *
   * @param e1 the e unit
   */
  void normalizeDo( EDBUnit e1 ){ 
    EDBUnit n1 = e1.getNext();
    if( n1 == null )
      return;
    Double d1 = Double.valueOf(n1.getData())
    d1 = d1 / tempValue;
    n1.setData(d1.toString());
    normalizeDo(n1);
  }
View Full Code Here

   * Sum.
   *
   * @param e1 the e unit
   */
  void sum( EDBUnit e1 ){
    EDBUnit n1 = e1.getNext();
    if( n1 == null )
      return;
    Double d1 = Double.valueOf(n1.getData());
    tempValue += d1;
    sum(n1);
  }
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.