SplitEvaluator.java
Upload User: rhdiban
Upload Date: 2013-08-09
Package Size: 15085k
Code Size: 4k
Category:

Windows Develop

Development Platform:

Java

  1. /*
  2.  *    This program is free software; you can redistribute it and/or modify
  3.  *    it under the terms of the GNU General Public License as published by
  4.  *    the Free Software Foundation; either version 2 of the License, or
  5.  *    (at your option) any later version.
  6.  *
  7.  *    This program is distributed in the hope that it will be useful,
  8.  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.  *    GNU General Public License for more details.
  11.  *
  12.  *    You should have received a copy of the GNU General Public License
  13.  *    along with this program; if not, write to the Free Software
  14.  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15.  */
  16. /*
  17.  *    SplitEvaluator.java
  18.  *    Copyright (C) 1999 Len Trigg
  19.  *
  20.  */
  21. package weka.experiment;
  22. import weka.core.Instances;
  23. import java.io.Serializable;
  24. /**
  25.  * Interface to objects able to generate a fixed set of results for
  26.  * a particular split of a dataset. The set of results should contain
  27.  * fields related to any settings of the SplitEvaluator (not including
  28.  * the dataset name. For example, one field for the classifier used to
  29.  * get the results, another for the classifier options, etc). <p>
  30.  *
  31.  * Possible implementations of SplitEvaluator: <br>
  32.  * <ul>
  33.  *   <li>StdClassification results
  34.  *   <li>StdRegression results
  35.  * </ul>
  36.  *
  37.  * @author Len Trigg (trigg@cs.waikato.ac.nz)
  38.  * @version $Revision: 1.6 $
  39.  */
  40. public interface SplitEvaluator extends Serializable {
  41.   
  42.   /**
  43.    * Sets a list of method names for additional measures to look for
  44.    * in SplitEvaluators.
  45.    * @param additionalMeasures a list of method names
  46.    */
  47.   void setAdditionalMeasures(String [] additionalMeasures);
  48.   /**
  49.    * Gets the names of each of the key columns produced for a single run.
  50.    * The names should not contain spaces (use '_' instead for easy 
  51.    * translation.) The number of key fields must be constant for a given 
  52.    * SplitEvaluator.
  53.    *
  54.    * @return an array containing the name of each key column
  55.    */
  56.   String [] getKeyNames();
  57.   /**
  58.    * Gets the data types of each of the key columns produced for a single run.
  59.    * The number of key fields must be constant
  60.    * for a given SplitEvaluator.
  61.    *
  62.    * @return an array containing objects of the type of each key column. The 
  63.    * objects should be Strings, or Doubles.
  64.    */
  65.   Object [] getKeyTypes();
  66.   /**
  67.    * Gets the names of each of the result columns produced for a single run.
  68.    * The names should not contain spaces (use '_' instead for easy 
  69.    * translation.) The number of result fields must be constant
  70.    * for a given SplitEvaluator.
  71.    *
  72.    * @return an array containing the name of each result column
  73.    */
  74.   String [] getResultNames();
  75.   /**
  76.    * Gets the data types of each of the result columns produced for a 
  77.    * single run. The number of result fields must be constant
  78.    * for a given SplitEvaluator.
  79.    *
  80.    * @return an array containing objects of the type of each result column. 
  81.    * The objects should be Strings, or Doubles.
  82.    */
  83.   Object [] getResultTypes();
  84.   /**
  85.    * Gets the key describing the current SplitEvaluator. For example
  86.    * This may contain the name of the classifier used for classifier
  87.    * predictive evaluation. The number of key fields must be constant
  88.    * for a given SplitEvaluator.
  89.    *
  90.    * @return a value of type 'Object'
  91.    */
  92.   Object [] getKey();
  93.   /**
  94.    * Gets the results for the supplied train and test datasets.
  95.    *
  96.    * @param train the training Instances.
  97.    * @param test the testing Instances.
  98.    * @return the results stored in an array. The objects stored in
  99.    * the array may be Strings, Doubles, or null (for the missing value).
  100.    * @exception Exception if a problem occurs while getting the results
  101.    */
  102.   Object [] getResult(Instances train, Instances test) throws Exception;
  103.   /**
  104.    * Returns the raw output for the most recent call to getResult. Useful
  105.    * for debugging splitEvaluators.
  106.    * 
  107.    * @return the raw output corresponding to the most recent call
  108.    * to getResut
  109.    */
  110.   String getRawResultOutput();
  111. } // SplitEvaluator