Package edu.gmu.seor.prognos.unbbayesplugin.jt.prs

Examples of edu.gmu.seor.prognos.unbbayesplugin.jt.prs.Node


        if (fixo[control]) {
            div(control+1, fixo, coord, soma);
            return;
        }

        Node node = nos.get(control);
        for (int i = 0; i < node.getStatesSize(); i++) {
            coord[control] = i;
            div(control+1, fixo, coord, soma);
        }
    }
View Full Code Here


     if(lastCPTISA != null && lastCPTISA.map.size() != 0 ){
      for( String str : lastCPTISA.map.keySet() ){
        EDBUnit t = lastCPTISA.map.get(str)
       
        int variableIndex = auxTab.indexOfVariable( t.getData() );
        Node n = (Node)auxTab.getVariableAt(variableIndex);
        coord[variableIndex] = getStateIndexFromBN( n, t.getName() );
       
        AddNewStatesValueToBNNode( t, coord, stateIndexMap, auxTab);
      }
    }
View Full Code Here

  public void createUDBfromSDB(ProbabilisticNetwork rede, EDBUnit sNode){
    EDBUnit states = sNode.get("STATES");
    EDBUnit cpt = sNode.get("CPT");
    EDBUnit eq = sNode.get("INFO.EQUATION");
    String type = sNode.get("INFO.TYPE").getData();
    Node uNode = null;
       
    if( type.equalsIgnoreCase("Discrete") ){
      //create new Probabilistic uNode
      uNode = new ProbabilisticNode();
      uNode.setName(sNode.getName());
      uNode.setDescription(sNode.getName());
      //reset all states
      ((ProbabilisticNode )uNode).removeAllStates();
       //set states
      ArrayMap<Object, Integer> stateIndexMap = new ArrayMap<Object, Integer>();
      int c = 0;
      EDBUnit stateFirst = states.getNext();
      uNode.appendState(stateFirst.getName());
      stateIndexMap.put( stateFirst.getName(),  c++);
      AddNewStatesToBNNode( uNode, stateIndexMap, c, stateFirst.getNext() );
      
    }else
    if( type.equalsIgnoreCase("Continuous") ){
      //create new Continuous uNode
      uNode = new ContinuousNode();
      uNode.setName(sNode.getName());
      uNode.setDescription(sNode.getName());
    }
     
    //initialize Potential Table
    if (uNode instanceof ITabledVariable) {
      PotentialTable potTable = ((ITabledVariable)uNode).getPotentialTable();
View Full Code Here

  public void setStatesOfUDB(ProbabilisticNetwork rede, EDBUnit sNode){
    EDBUnit states = sNode.get("STATES");
    EDBUnit cpt = sNode.get("CPT");
    EDBUnit eq = sNode.get("EQUATION");
    String type = sNode.get("INFO.TYPE").getData();
    Node uNode = rede.getNode(sNode.getName());
       
    if( type.equalsIgnoreCase("Discrete") ){
      ArrayMap<Object, Integer> stateIndexMap = new ArrayMap<Object, Integer>();
      for( int i = 0; i < uNode.getStatesSize(); i++ ){
        stateIndexMap.put(uNode.getStateAt(i), i);
      }
     
      /////////////////////////////////////////////////////////////////////////////////////
      //3. fill zero on table 
      ITabledVariable aux = null;
      PotentialTable auxTab = null;
      if (uNode instanceof ITabledVariable) {
        aux = (ITabledVariable) uNode;
        auxTab = aux.getPotentialTable() ;
      }
      
      int curStateSize = uNode.getStatesSize()
     
      for( INode parent : uNode.getParentNodes() )
        curStateSize *= parent.getStatesSize();
     
      for( int i = 0; i < curStateSize; i++ )
        auxTab.addValueAt(i, 0);
     
      auxTab.setTableSize(curStateSize);
   
      /////////////////////////////////////////////////////////////////////////////////////
      //4. add new values in the states of BN
      // EX]
      // CPT[Isa]parent1.state1{parent1.Name}[Isa]parent2.state1{parent2.Name}[Next]cur.state1[Next]cur.state2
      // ...
      int coord[] = new int[uNode.getParentNodes().size()+1];
       
      AddNewStatesValueToBNNode( cpt, coord, stateIndexMap, auxTab ) ;
      
      //5. add new scripts of BN
     //  CPS.getInstance().setScript(cNode, eq.getData()); 
View Full Code Here

 
  public void createEdgeOfUDB( ProbabilisticNetwork rede, EDBUnit node, EDBUnit nextParent ){
    if( nextParent == null )
      return;
   
    Node uNodeDes = rede.getNode(node.getName());
    Node uNodeSrs = rede.getNode(nextParent.getName());
   
    createEdge( rede, uNodeSrs, uNodeDes );
   
    createEdgeOfUDB( rede, node, nextParent.getNext() );
  }
View Full Code Here

    //step 4. set evidences
     for( String str : ISA.getMap().keySet() ){
      EDBUnit node = ISA.map.get(str);
      EDBUnit evidence = node.get("EVIDENCE");
      EDBUnit type = node.get("INFO.TYPE");
      Node uNode = rede.getNode(str);
           
      if( evidence != null ){
        if( type.getData().equalsIgnoreCase("Discrete") ){
          rede.setDescreteEvidence((ProbabilisticNode)uNode, uNode.getState(evidence.getData()));
         
        }else
        if( type.getData().equalsIgnoreCase("Continuous") ){
          rede.setContinuousEvidence((ContinuousNode)uNode, evidence.getDataByDouble());
        }
View Full Code Here

    System.out.println("Variable list size in computeFactors "+sizeVariaveis);
    if (factorsPT == null || factorsPT.length < sizeVariaveis) {
       factorsPT = new int[sizeVariaveis];
    }
    factorsPT[0] = 1;
    Node auxNo;
    for (int i = 1; i < sizeVariaveis; i++) {
      auxNo = variableList.get(i-1);
      factorsPT[i] = factorsPT[i-1] * auxNo.getStatesSize();
    }
  }
 
View Full Code Here

      jpd.data[linearCoordDestination] = value;
      marked[coord] = true;
      return;
    }
   
    Node node = variableList.get(control);
    if (control == index) {
      // if the current iterated variable is the one we want to delete, then iterate only until 1,
      // because the position 0 will hold the sum.
      for (int i = node.getStatesSize()-1; i >= 1; i--) {
        sumAux(control-1, index, coord + i*factorsPT[control], i*factorsPT[index], marked);
     
    } else {
      for (int i = node.getStatesSize()-1; i >= 0; i--) {
        sumAux(control-1, index, coord + i*factorsPT[control], base, marked);
      }
    }
  }
View Full Code Here

      jpd.remove(linearCoordToKill);
      return;
    }

    int fim = (index == control) ? 1 : 0;
    Node node = variableList.get(control);
    for (int i = node.getStatesSize()-1; i >= fim; i--) {
      coord[control] = i;
      finding(control-1, index, coord, state);
    }
  }
View Full Code Here

     * @param   minCapacity   the desired minimum capacity.
     */
    public final void ensureCapacity(int minCapacity) {
        int oldCapacity = data.length;
        if (minCapacity > oldCapacity) {
            Node oldData[] = data;
            int newCapacity = (oldCapacity * 3)/2 + 1;
            if (newCapacity < minCapacity) {
               newCapacity = minCapacity;
            }
            data = new Node[newCapacity];
View Full Code Here

TOP

Related Classes of edu.gmu.seor.prognos.unbbayesplugin.jt.prs.Node

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.