Package weka.core

Examples of weka.core.SerializedObject


      for (int iNode = 0; iNode < nodes.size(); iNode++) {
        int nTargetNode = (Integer) nodes.elementAt(iNode);
        m_nodes.addElement(nTargetNode);
        m_att[iNode] = m_Instances.attribute(nTargetNode);
        try {
          SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
          m_CPT[iNode] = (Estimator[]) so.getObject();
          ;
          so = new SerializedObject(m_ParentSets[nTargetNode]);
          m_ParentSet[iNode] = (ParentSet) so.getObject();
        } catch (Exception e) {
          e.printStackTrace();
        }
        m_nPosX[iNode] = getPositionX(nTargetNode);
        m_nPosY[iNode] = getPositionY(nTargetNode);
View Full Code Here


        int iTargetNode = 0;
        for (int iParentSet = 0; iParentSet < nAtts; iParentSet++) {
          if (iTargetNode < m_nodes.size()
              && (Integer) m_nodes.elementAt(iTargetNode) == (Integer) iParentSet) {
            SerializedObject so = new SerializedObject(m_ParentSet[iTargetNode]);
            parentSets[iParentSet] = (ParentSet) so.getObject();
            iTargetNode++;
          } else {
            parentSets[iParentSet] = m_ParentSets[iParentSet - iTargetNode];
            for (int iParent = 0; iParent < parentSets[iParentSet].getNrOfParents(); iParent++) {
              int nParent = parentSets[iParentSet].getParent(iParent);
              parentSets[iParentSet].SetParent(iParent, offset[nParent]);
            }
          }
        }
        m_ParentSets = parentSets;
        // update distributions
        Estimator[][] distributions = new Estimator[nAtts][];
        iTargetNode = 0;
        for (int iNode = 0; iNode < nAtts; iNode++) {
          if (iTargetNode < m_nodes.size() && (Integer) m_nodes.elementAt(iTargetNode) == (Integer) iNode) {
            SerializedObject so = new SerializedObject(m_CPT[iTargetNode]);
            distributions[iNode] = (Estimator[]) so.getObject();
            iTargetNode++;
          } else {
            distributions[iNode] = m_Distributions[iNode - iTargetNode];
          }
        }
View Full Code Here

      try {
        m_nParent = nParent;
        m_children = new FastVector();
        m_children.addElement(nChild);
        //m_nChild = nChild;
        SerializedObject so = new SerializedObject(m_Distributions[nChild]);
        m_CPT = new Estimator[1][];
        m_CPT[0] = (Estimator[]) so.getObject();
        ;
      } catch (Exception e) {
        e.printStackTrace();
      }
    } // c'tor
View Full Code Here

        m_children = new FastVector();
        m_CPT = new Estimator[children.size()][];
        for (int iChild = 0; iChild < children.size(); iChild++) {
          int nChild = (Integer) children.elementAt(iChild);
          m_children.addElement(nChild);
          SerializedObject so = new SerializedObject(m_Distributions[nChild]);
          m_CPT[iChild] = (Estimator[]) so.getObject();
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    } // c'tor
View Full Code Here

    public void undo() {
      try {
        for (int iChild = 0; iChild < m_children.size(); iChild++) {
          int nChild = (Integer) m_children.elementAt(iChild);
          deleteArc(m_nParent, nChild);
          SerializedObject so = new SerializedObject(m_CPT[iChild]);
          m_Distributions[nChild] = (Estimator[]) so.getObject();
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    } // undo
View Full Code Here

      m_nParent = nParent;
      m_nParents = new int[getNrOfParents(nChild)];
      for (int iParent = 0; iParent < m_nParents.length; iParent++) {
        m_nParents[iParent] = getParent(nChild, iParent);
      }
      SerializedObject so = new SerializedObject(m_Distributions[nChild]);
      m_CPT = (Estimator[]) so.getObject();
      } catch (Exception e) {
        e.printStackTrace();
      }
    } // c'tor
View Full Code Here

      }
    } // c'tor

    public void undo() {
      try {
        SerializedObject so = new SerializedObject(m_CPT);
        m_Distributions[m_nChild] = (Estimator[]) so.getObject();
        ParentSet parentSet = new ParentSet();
        for (int iParent = 0; iParent < m_nParents.length; iParent++) {
          parentSet.addParent(m_nParents[iParent], m_Instances);
        }
        m_ParentSets[m_nChild] = parentSet;
View Full Code Here

    double[][] m_P;

    SetDistributionAction(int nTargetNode, double[][] P) {
      try {
        m_nTargetNode = nTargetNode;
        SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
        m_CPT = (Estimator[]) so.getObject();
        ;
        m_P = P;
      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

      }
    } // c'tor

    public void undo() {
      try {
        SerializedObject so = new SerializedObject(m_CPT);
        m_Distributions[m_nTargetNode] = (Estimator[]) so.getObject();
      } catch (Exception e) {
        e.printStackTrace();
      }
    } // undo
View Full Code Here

    DelValueAction(int nTargetNode, String sValue) {
      try {
        m_nTargetNode = nTargetNode;
        m_sValue = sValue;
        m_att = m_Instances.attribute(nTargetNode);
        SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
        m_CPT = (Estimator[]) so.getObject();
        ;
        m_children = new FastVector();
        for (int iNode = 0; iNode < getNrOfNodes(); iNode++) {
          if (m_ParentSets[iNode].contains(nTargetNode)) {
            m_children.addElement(iNode);
View Full Code Here

TOP

Related Classes of weka.core.SerializedObject

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.