Package weka.core

Examples of weka.core.SerializedObject


  public static Kernel[] makeCopies(Kernel model, int num) throws Exception {
    if (model == null)
      throw new Exception("No model kernel set");

    Kernel[] kernels = new Kernel[num];
    SerializedObject so = new SerializedObject(model);
    for (int i = 0; i < kernels.length; i++)
      kernels[i] = (Kernel) so.getObject();

    return kernels;
  }
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

    }

    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

                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

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

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

        // unbiased predictions
        insts.randomize(random);
        insts.stratify(numFolds);
        for (int i = 0; i < numFolds; i++) {
          Instances train = insts.trainCV(numFolds, i, random);
          SerializedObject so = new SerializedObject(this);
          BinaryMISMO smo = (BinaryMISMO)so.getObject();
          smo.buildClassifier(train, cl1, cl2, false, -1, -1);
          Instances test = insts.testCV(numFolds, i);
          for (int j = 0; j < test.numInstances(); j++) {
            double[] vals = new double[2];
            vals[0] = smo.SVMOutput(-1, test.instance(j));
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

      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

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.