Package weka.core

Examples of weka.core.SerializedObject


    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


    } // c'tor

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

    grph = ((Drawable)clusterer).graph();
        } catch (Exception ex) {
        }
      }
      // copy full model for output
      SerializedObject so = new SerializedObject(clusterer);
      fullClusterer = (Clusterer) so.getObject();
     
      ClusterEvaluation eval = new ClusterEvaluation();
      eval.setClusterer(clusterer);
      switch (testMode) {
        case 3: case 5: // Test on training
View Full Code Here

    DeleteNodeAction(int nTargetNode) {
      m_nTargetNode = nTargetNode;
      m_att = m_Instances.attribute(nTargetNode);
      try {
        SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
        m_CPT = (Estimator[]) so.getObject();
        ;
        so = new SerializedObject(m_ParentSets[nTargetNode]);
        m_ParentSet = (ParentSet) so.getObject();
      } catch (Exception e) {
        e.printStackTrace();
      }
      m_deleteArcActions = new FastVector();
      for (int iNode = 0; iNode < getNrOfNodes(); iNode++) {
View Full Code Here

        // update parentsets
        ParentSet[] parentSets = new ParentSet[nAtts];
        int nX = 0;
        for (int iParentSet = 0; iParentSet < nAtts; iParentSet++) {
          if (iParentSet == m_nTargetNode) {
            SerializedObject so = new SerializedObject(m_ParentSet);
            parentSets[iParentSet] = (ParentSet) so.getObject();
            nX = 1;
          } else {
            parentSets[iParentSet] = m_ParentSets[iParentSet - nX];
            for (int iParent = 0; iParent < parentSets[iParentSet].getNrOfParents(); iParent++) {
              int nParent = parentSets[iParentSet].getParent(iParent);
              if (nParent >= m_nTargetNode) {
                parentSets[iParentSet].SetParent(iParent, nParent + 1);
              }
            }
          }
        }
        m_ParentSets = parentSets;
        // update distributions
        Estimator[][] distributions = new Estimator[nAtts][];
        nX = 0;
        for (int iNode = 0; iNode < nAtts; iNode++) {
          if (iNode == m_nTargetNode) {
            SerializedObject so = new SerializedObject(m_CPT);
            distributions[iNode] = (Estimator[]) so.getObject();
            nX = 1;
          } else {
            distributions[iNode] = m_Distributions[iNode - nX];
          }
        }
View Full Code Here

      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

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.