All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.experiment.RegressionSplitEvaluator Maven / Gradle / Ivy

Go to download

The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This version represents the developer version, the "bleeding edge" of development, you could say. New functionality gets added to this version.

There is a newer version: 3.9.6
Show newest version
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see .
 */

/*
 *    RegressionSplitEvaluator.java
 *    Copyright (C) 1999-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.experiment;

import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Vector;

import weka.classifiers.AbstractClassifier;
import weka.classifiers.Classifier;
import weka.classifiers.Evaluation;
import weka.classifiers.evaluation.AbstractEvaluationMetric;
import weka.classifiers.rules.ZeroR;
import weka.core.AdditionalMeasureProducer;
import weka.core.Attribute;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionHandler;
import weka.core.RevisionUtils;
import weka.core.Summarizable;
import weka.core.Utils;

/**
 *  A SplitEvaluator that produces results for a
 * classification scheme on a numeric class attribute.
 * 

* * * Valid options are: *

* *

 * -no-size
 *  Skips the determination of sizes (train/test/classifier)
 *  (default: sizes are determined)
 * 
* *
 * -W <class name>
 *  The full class name of the classifier.
 *  eg: weka.classifiers.bayes.NaiveBayes
 * 
* *
 * Options specific to classifier weka.classifiers.rules.ZeroR:
 * 
* *
 * -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console
 * 
* * * * All options after -- will be passed to the classifier. * * @author Len Trigg ([email protected]) * @version $Revision: 11323 $ */ public class RegressionSplitEvaluator implements SplitEvaluator, OptionHandler, AdditionalMeasureProducer, RevisionHandler { /** for serialization */ static final long serialVersionUID = -328181640503349202L; /** The template classifier */ protected Classifier m_Template = new ZeroR(); /** The classifier used for evaluation */ protected Classifier m_Classifier; /** Holds the most recently used Evaluation object */ protected Evaluation m_Evaluation; /** The names of any additional measures to look for in SplitEvaluators */ protected String[] m_AdditionalMeasures = null; /** * Array of booleans corresponding to the measures in m_AdditionalMeasures * indicating which of the AdditionalMeasures the current classifier can * produce */ protected boolean[] m_doesProduce = null; /** Holds the statistics for the most recent application of the classifier */ protected String m_result = null; /** The classifier options (if any) */ protected String m_ClassifierOptions = ""; /** The classifier version */ protected String m_ClassifierVersion = ""; /** whether to skip determination of sizes (train/test/classifier). */ private boolean m_NoSizeDetermination; /** The length of a key */ private static final int KEY_SIZE = 3; /** The length of a result */ private static final int RESULT_SIZE = 27; protected final List m_pluginMetrics = new ArrayList(); protected int m_numPluginStatistics = 0; /** * No args constructor. */ public RegressionSplitEvaluator() { updateOptions(); List pluginMetrics = AbstractEvaluationMetric .getPluginMetrics(); if (pluginMetrics != null) { for (AbstractEvaluationMetric m : pluginMetrics) { if (m.appliesToNumericClass()) { m_pluginMetrics.add(m); m_numPluginStatistics += m.getStatisticNames().size(); } } } } /** * Returns a string describing this split evaluator * * @return a description of the split evaluator suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "A SplitEvaluator that produces results for a classification " + "scheme on a numeric class attribute."; } /** * Returns an enumeration describing the available options.. * * @return an enumeration of all the available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy