@Override public String toString() { StringBuffer buf = new StringBuffer(); for (int iNode = 0; iNode < m_nNodes.length; iNode++) { buf.append(m_bayesNet.getNodeName(m_nNodes[iNode]) + ": "); for (int iValue = 0; iValue < m_MarginalP[iNode].length; iValue++) { buf.append(m_MarginalP[iNode][iValue] + " "); } buf.append('\n'); } for (Object element : m_children) { JunctionTreeNode childNode = (JunctionTreeNode) element; buf.append("----------------\n"); buf.append(childNode.toString()); } return buf.toString(); } // toString
@Override public String toString() { StringBuffer buf = new StringBuffer(); for (int iNode = 0; iNode < m_nNodes.length; iNode++) { buf.append(m_bayesNet.getNodeName(m_nNodes[iNode]) + ": "); for (int iValue = 0; iValue < m_MarginalP[iNode].length; iValue++) { buf.append(m_MarginalP[iNode][iValue] + " "); } buf.append('\n'); } for (Object element : m_children) { JunctionTreeNode childNode = (JunctionTreeNode) element; buf.append("----------------\n"); buf.append(childNode.toString()); } return buf.toString(); } // toString
/** * synchronizes the node ordering of this Bayes network with those in the * other network (if possible). * * @param other Bayes network to synchronize with * @throws Exception if nr of attributes differs or not all of the variables * have the same name. */ public void Sync(BayesNet other) throws Exception { int nAtts = m_Instances.numAttributes(); if (nAtts != other.m_Instances.numAttributes()) { throw new Exception( "Cannot synchronize networks: different number of attributes."); } m_order = new int[nAtts]; for (int iNode = 0; iNode < nAtts; iNode++) { String sName = other.getNodeName(iNode); m_order[getNode(sName)] = iNode; } } // Sync
/** * synchronizes the node ordering of this Bayes network with those in the * other network (if possible). * * @param other Bayes network to synchronize with * @throws Exception if nr of attributes differs or not all of the variables * have the same name. */ public void Sync(BayesNet other) throws Exception { int nAtts = m_Instances.numAttributes(); if (nAtts != other.m_Instances.numAttributes()) { throw new Exception( "Cannot synchronize networks: different number of attributes."); } m_order = new int[nAtts]; for (int iNode = 0; iNode < nAtts; iNode++) { String sName = other.getNodeName(iNode); m_order[getNode(sName)] = iNode; } } // Sync
while (nodes.hasNext()) { int iNode2 = nodes.next(); System.out.print(iNode2 + " " + bayesNet.getNodeName(iNode2)); if (nodes.hasNext()) { System.out.print(","); while (nodes.hasNext()) { int iNode2 = nodes.next(); System.out.print(iNode2 + " " + bayesNet.getNodeName(iNode2)); if (nodes.hasNext()) { System.out.print(",");
while (nodes.hasNext()) { int iNode2 = nodes.next(); System.out.print(iNode2 + " " + bayesNet.getNodeName(iNode2)); if (nodes.hasNext()) { System.out.print(","); while (nodes.hasNext()) { int iNode2 = nodes.next(); System.out.print(iNode2 + " " + bayesNet.getNodeName(iNode2)); if (nodes.hasNext()) { System.out.print(",");
int iBIFAttribute = bifReader.getNode(bayesNet.getNodeName(iAttribute)); ParentSet bifParentSet = bifReader.getParentSet(iBIFAttribute); for (int iBIFParent = 0; iBIFParent < bifParentSet.getNrOfParents(); iBIFParent++) { int iParent = 0; while (iParent < instances.numAttributes() && !bayesNet.getNodeName(iParent).equals(sParent)) { iParent++;
int iBIFAttribute = bifReader.getNode(bayesNet.getNodeName(iAttribute)); ParentSet bifParentSet = bifReader.getParentSet(iBIFAttribute); for (int iBIFParent = 0; iBIFParent < bifParentSet.getNrOfParents(); iBIFParent++) { int iParent = 0; while (iParent < instances.numAttributes() && !bayesNet.getNodeName(iParent).equals(sParent)) { iParent++;
BIFReader initialNet = new BIFReader().processFile(m_sInitalBIFFile); for (int iAttribute = 0; iAttribute < instances.numAttributes(); iAttribute++) { int iNode = initialNet.getNode(bayesNet.getNodeName(iAttribute)); for (int iParent = 0; iParent < initialNet.getNrOfParents(iAttribute); iParent++) { String sParent = initialNet.getNodeName(initialNet.getParent(iNode, int nParent = 0; while (nParent < bayesNet.getNrOfNodes() && !bayesNet.getNodeName(nParent).equals(sParent)) { nParent++;
BIFReader initialNet = new BIFReader().processFile(m_sInitalBIFFile); for (int iAttribute = 0; iAttribute < instances.numAttributes(); iAttribute++) { int iNode = initialNet.getNode(bayesNet.getNodeName(iAttribute)); for (int iParent = 0; iParent < initialNet.getNrOfParents(iAttribute); iParent++) { String sParent = initialNet.getNodeName(initialNet.getParent(iNode, int nParent = 0; while (nParent < bayesNet.getNrOfNodes() && !bayesNet.getNodeName(nParent).equals(sParent)) { nParent++;