Package weka.core

Examples of weka.core.WekaException


   */
  public void printClassification(Classifier classifier, Instance inst, int index) throws Exception {
    String  error;
   
    if ((error = checkBasic()) != null)
      throw new WekaException(error);
   
    doPrintClassification(classifier, inst, index);
  }
View Full Code Here


  public void printFooter() throws Exception {
    String    error;
    BufferedWriter  writer;
   
    if ((error = checkBasic()) != null)
      throw new WekaException(error);
   
    doPrintFooter();
   
    // write output to file
    if (!m_OutputFile.isDirectory()) {
View Full Code Here

      // test set
      String filename = createFilename(train);
      File file = new File(filename);
      if (!file.exists())
  throw new WekaException("Test set '" + filename + "' not found!");
      Instances test = DataSource.read(filename);
      // can we set the class attribute safely?
      if (train.numAttributes() == test.numAttributes())
  test.setClassIndex(train.classIndex());
      else
  throw new WekaException(
      "Train and test set (= " + filename + ") "
      + "differ in number of attributes: "
      + train.numAttributes() + " != " + test.numAttributes());
      // test headers
      if (!train.equalHeaders(test))
  throw new WekaException(
      "Train and test set (= " + filename + ") "
      + "are not compatible:\n"
      + train.equalHeadersMsg(test));
     
      try {
View Full Code Here

    // ignored
  }
  ois.close();
  // same dataset format?
  if ((header != null) && (!header.equalHeaders(toFilterIgnoringAttributes)))
    throw new WekaException(
        "Training header of clusterer and filter dataset don't match:\n"
        + header.equalHeadersMsg(toFilterIgnoringAttributes));
      }
      else {
  m_ActualClusterer = AbstractClusterer.makeCopy(m_Clusterer);
View Full Code Here

    if (!isFirstBatchDone()) {
      getActualClassifier();
      if (!getSerializedClassifierFile().isDirectory()) {
  // same dataset format?
  if ((m_SerializedHeader != null) && (!m_SerializedHeader.equalHeaders(instances)))
    throw new WekaException(
        "Training header of classifier and filter dataset don't match:\n"
        + m_SerializedHeader.equalHeadersMsg(instances));
      }
      else {
  m_ActualClassifier.buildClassifier(instances);
View Full Code Here

        FeatureNode[] x = instanceToArray(instance);
        double[] result = new double[instance.numClasses()];
        if (m_ProbabilityEstimates) {
            if (m_SolverType != SolverType.L2R_LR && m_SolverType != SolverType.L2R_LR_DUAL && m_SolverType != SolverType.L1R_LR) {
                throw new WekaException("probability estimation is currently only " + "supported for L2-regularized logistic regression");
            }

            int[] labels = m_Model.getLabels();
            double[] prob_estimates = new double[instance.numClasses()];
View Full Code Here

TOP

Related Classes of weka.core.WekaException

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.