Package weka.core

Examples of weka.core.SerializedObject


    } // 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


   * @param model the associator to copy
   * @return a deep copy of the associator
   * @exception Exception if an error occurs
   */
  public static Associator makeCopy(Associator model) throws Exception {
    return (Associator) new SerializedObject(model).getObject();
  }
View Full Code Here

    if (model == null) {
      throw new Exception("No model associator set");
    }
    Associator [] associators = new Associator [num];
    SerializedObject so = new SerializedObject(model);
    for(int i = 0; i < associators.length; i++) {
      associators[i] = (Associator) so.getObject();
    }
    return associators;
  }
View Full Code Here

                if (m_BayesNet.getEvidence(m_nCurrentNode) < 0 && iValue >= 0) {
                  m_BayesNet.setEvidence(m_nCurrentNode, iValue);
                  m_marginCalculatorWithEvidence.setEvidence(m_nCurrentNode, iValue);
                } else {
                  m_BayesNet.setEvidence(m_nCurrentNode, iValue);
                  SerializedObject so = new SerializedObject(m_marginCalculator);
                  m_marginCalculatorWithEvidence = (MarginCalculator) so.getObject();
                  for (int iNode = 0; iNode < m_BayesNet.getNrOfNodes(); iNode++) {
                    if (m_BayesNet.getEvidence(iNode) >= 0) {
                      m_marginCalculatorWithEvidence.setEvidence(iNode, m_BayesNet.getEvidence(iNode));
                    }
                  }
View Full Code Here

    }

    try {
      m_marginCalculator = new MarginCalculator();
      m_marginCalculator.calcMargins(m_BayesNet);
      SerializedObject so = new SerializedObject(m_marginCalculator);
      m_marginCalculatorWithEvidence = (MarginCalculator) so.getObject();
      for (int iNode = 0; iNode < m_BayesNet.getNrOfNodes(); iNode++) {
        if (m_BayesNet.getEvidence(iNode) >= 0) {
          m_marginCalculatorWithEvidence.setEvidence(iNode, m_BayesNet.getEvidence(iNode));
        }
      }
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

      grph = ((Drawable)classifier).graph();
    } catch (Exception ex) {
    }
        }
        // copy full model for output
        SerializedObject so = new SerializedObject(classifier);
        fullClassifier = (Classifier) so.getObject();
      }
     
      switch (testMode) {
        case 3: // Test on training
        m_Log.statusMessage("Evaluating on training data...");
View Full Code Here

   * @return a deep copy of the estimator
   * @exception Exception if an error occurs
   */
  public static Estimator makeCopy(Estimator model) throws Exception {

    return (Estimator)new SerializedObject(model).getObject();
  }
View Full Code Here

    if (model == null) {
      throw new Exception("No model estimator set");
    }
    Estimator [] estimators = new Estimator [num];
    SerializedObject so = new SerializedObject(model);
    for(int i = 0; i < estimators.length; i++) {
      estimators[i] = (Estimator) so.getObject();
    }
    return estimators;
  }
View Full Code Here

      m_Instances.stratify(numFolds);

      for (int k = 0; k < list.length; k++) {
        for (int i = 0; i < numFolds; i++) {
          Instances train = m_Instances.trainCV(numFolds, i, random);
          SerializedObject so = new SerializedObject(this);
          BayesianLogisticRegression blr = (BayesianLogisticRegression) so.getObject();
          //          blr.setHyperparameterSelection(3);
          blr.setHyperparameterSelection(new SelectedTag(SPECIFIC_VALUE,
                                                         TAGS_HYPER_METHOD));
          blr.setHyperparameterValue(list[k]);
          //          blr.setPriorClass(PriorClass);
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.