[4] | 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 | /* |
---|
| 18 | * SplitEvaluator.java |
---|
| 19 | * Copyright (C) 1999 University of Waikato, Hamilton, New Zealand |
---|
| 20 | * |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | package weka.experiment; |
---|
| 25 | |
---|
| 26 | import weka.core.Instances; |
---|
| 27 | import java.io.Serializable; |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * Interface to objects able to generate a fixed set of results for |
---|
| 31 | * a particular split of a dataset. The set of results should contain |
---|
| 32 | * fields related to any settings of the SplitEvaluator (not including |
---|
| 33 | * the dataset name. For example, one field for the classifier used to |
---|
| 34 | * get the results, another for the classifier options, etc). <p> |
---|
| 35 | * |
---|
| 36 | * Possible implementations of SplitEvaluator: <br> |
---|
| 37 | * <ul> |
---|
| 38 | * <li>StdClassification results |
---|
| 39 | * <li>StdRegression results |
---|
| 40 | * </ul> |
---|
| 41 | * |
---|
| 42 | * @author Len Trigg (trigg@cs.waikato.ac.nz) |
---|
| 43 | * @version $Revision: 1.7 $ |
---|
| 44 | */ |
---|
| 45 | public interface SplitEvaluator extends Serializable { |
---|
| 46 | |
---|
| 47 | /** |
---|
| 48 | * Sets a list of method names for additional measures to look for |
---|
| 49 | * in SplitEvaluators. |
---|
| 50 | * @param additionalMeasures a list of method names |
---|
| 51 | */ |
---|
| 52 | void setAdditionalMeasures(String [] additionalMeasures); |
---|
| 53 | |
---|
| 54 | /** |
---|
| 55 | * Gets the names of each of the key columns produced for a single run. |
---|
| 56 | * The names should not contain spaces (use '_' instead for easy |
---|
| 57 | * translation.) The number of key fields must be constant for a given |
---|
| 58 | * SplitEvaluator. |
---|
| 59 | * |
---|
| 60 | * @return an array containing the name of each key column |
---|
| 61 | */ |
---|
| 62 | String [] getKeyNames(); |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * Gets the data types of each of the key columns produced for a single run. |
---|
| 66 | * The number of key fields must be constant |
---|
| 67 | * for a given SplitEvaluator. |
---|
| 68 | * |
---|
| 69 | * @return an array containing objects of the type of each key column. The |
---|
| 70 | * objects should be Strings, or Doubles. |
---|
| 71 | */ |
---|
| 72 | Object [] getKeyTypes(); |
---|
| 73 | |
---|
| 74 | /** |
---|
| 75 | * Gets the names of each of the result columns produced for a single run. |
---|
| 76 | * The names should not contain spaces (use '_' instead for easy |
---|
| 77 | * translation.) The number of result fields must be constant |
---|
| 78 | * for a given SplitEvaluator. |
---|
| 79 | * |
---|
| 80 | * @return an array containing the name of each result column |
---|
| 81 | */ |
---|
| 82 | String [] getResultNames(); |
---|
| 83 | |
---|
| 84 | /** |
---|
| 85 | * Gets the data types of each of the result columns produced for a |
---|
| 86 | * single run. The number of result fields must be constant |
---|
| 87 | * for a given SplitEvaluator. |
---|
| 88 | * |
---|
| 89 | * @return an array containing objects of the type of each result column. |
---|
| 90 | * The objects should be Strings, or Doubles. |
---|
| 91 | */ |
---|
| 92 | Object [] getResultTypes(); |
---|
| 93 | |
---|
| 94 | /** |
---|
| 95 | * Gets the key describing the current SplitEvaluator. For example |
---|
| 96 | * This may contain the name of the classifier used for classifier |
---|
| 97 | * predictive evaluation. The number of key fields must be constant |
---|
| 98 | * for a given SplitEvaluator. |
---|
| 99 | * |
---|
| 100 | * @return a value of type 'Object' |
---|
| 101 | */ |
---|
| 102 | Object [] getKey(); |
---|
| 103 | |
---|
| 104 | /** |
---|
| 105 | * Gets the results for the supplied train and test datasets. |
---|
| 106 | * |
---|
| 107 | * @param train the training Instances. |
---|
| 108 | * @param test the testing Instances. |
---|
| 109 | * @return the results stored in an array. The objects stored in |
---|
| 110 | * the array may be Strings, Doubles, or null (for the missing value). |
---|
| 111 | * @exception Exception if a problem occurs while getting the results |
---|
| 112 | */ |
---|
| 113 | Object [] getResult(Instances train, Instances test) throws Exception; |
---|
| 114 | |
---|
| 115 | /** |
---|
| 116 | * Returns the raw output for the most recent call to getResult. Useful |
---|
| 117 | * for debugging splitEvaluators. |
---|
| 118 | * |
---|
| 119 | * @return the raw output corresponding to the most recent call |
---|
| 120 | * to getResut |
---|
| 121 | */ |
---|
| 122 | String getRawResultOutput(); |
---|
| 123 | |
---|
| 124 | } // SplitEvaluator |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | |
---|