source: src/main/java/weka/experiment/ResultProducer.java @ 7

Last change on this file since 7 was 4, checked in by gnappo, 14 years ago

Import di weka.

File size: 5.8 KB
RevLine 
[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 *    ResultProducer.java
19 *    Copyright (C) 1999 University of Waikato, Hamilton, New Zealand
20 *
21 */
22
23
24package weka.experiment;
25
26import weka.core.Instances;
27import java.io.Serializable;
28
29/**
30 * This interface defines the methods required for an object
31 * that produces results for different randomizations of a dataset. <p>
32 *
33 * Possible implementations of ResultProducer: <br>
34 * <ul>
35 *   <li>Random test/train splits
36 *   <li>CrossValidation splits
37 *   <li>LearningCurve splits (multiple results per run?)
38 *   <li>Averaging results of other result producers
39* </ul>
40 *
41 * @author Len Trigg (trigg@cs.waikato.ac.nz)
42 * @version $Revision: 1.7 $
43 */
44
45public interface ResultProducer extends Serializable {
46 
47  /**
48   * Sets the dataset that results will be obtained for.
49   *
50   * @param instances a value of type 'Instances'.
51   */
52  void setInstances(Instances instances);
53
54  /**
55   * Sets the object to send results of each run to.
56   *
57   * @param listener a value of type 'ResultListener'
58   */
59  void setResultListener(ResultListener listener);
60
61  /**
62   * Sets a list of method names for additional measures to look for
63   * in SplitEvaluators.
64   * @param additionalMeasures a list of method names
65   */
66  void setAdditionalMeasures(String [] additionalMeasures);
67
68  /**
69   * Prepare to generate results. The ResultProducer should call
70   * preProcess(this) on the ResultListener it is to send results to.
71   *
72   * @exception Exception if an error occurs during preprocessing.
73   */
74  void preProcess() throws Exception;
75 
76  /**
77   * Perform any postprocessing. When this method is called, it indicates
78   * that no more requests to generate results for the current experiment
79   * will be sent. The ResultProducer should call
80   * preProcess(this) on the ResultListener it is to send results to.
81   *
82   * @exception Exception if an error occurs
83   */
84  void postProcess() throws Exception;
85 
86  /**
87   * Gets the results for a specified run number. Different run
88   * numbers correspond to different randomizations of the data. Results
89   * produced should be sent to the current ResultListener, but only
90   * if the ResultListener says the result is required (it may already
91   * have that result). A single run may produce multiple results.
92   *
93   * @param run the run number to generate results for.
94   * @exception Exception if a problem occurs while getting the results
95   */
96  void doRun(int run) throws Exception;
97 
98  /**
99   * Gets the keys for a specified run number. Different run
100   * numbers correspond to different randomizations of the data. Keys
101   * produced should be sent to the current ResultListener
102   *
103   * @param run the run number to get keys for.
104   * @exception Exception if a problem occurs while getting the keys
105   */
106  void doRunKeys(int run) throws Exception;
107
108  /**
109   * Gets the names of each of the key columns produced for a single run.
110   * The names should not contain spaces (use '_' instead for easy
111   * translation.)
112   *
113   * @return an array containing the name of each key column
114   * @exception Exception if the key names could not be determined (perhaps
115   * because of a problem from a nested sub-resultproducer)
116   */
117  String [] getKeyNames() throws Exception;
118
119  /**
120   * Gets the data types of each of the key columns produced for a single run.
121   *
122   * @return an array containing objects of the type of each key column. The
123   * objects should be Strings, or Doubles.
124   * @exception Exception if the key types could not be determined (perhaps
125   * because of a problem from a nested sub-resultproducer)
126   */
127  Object [] getKeyTypes() throws Exception;
128
129  /**
130   * Gets the names of each of the result columns produced for a single run.
131   * The names should not contain spaces (use '_' instead for easy
132   * translation.)
133   *
134   * @return an array containing the name of each result column
135   * @exception Exception if the result names could not be determined (perhaps
136   * because of a problem from a nested sub-resultproducer)
137   */
138  String [] getResultNames() throws Exception;
139
140  /**
141   * Gets the data types of each of the result columns produced for a
142   * single run.
143   *
144   * @return an array containing objects of the type of each result column.
145   * The objects should be Strings, or Doubles.
146   * @exception Exception if the result types could not be determined (perhaps
147   * because of a problem from a nested sub-resultproducer)
148   */
149  Object [] getResultTypes() throws Exception;
150
151  /**
152   * Gets a description of the internal settings of the result
153   * producer, sufficient for distinguishing a ResultProducer
154   * instance from another with different settings (ignoring
155   * those settings set through this interface). For example,
156   * a cross-validation ResultProducer may have a setting for the
157   * number of folds. For a given state, the results produced should
158   * be compatible. Typically if a ResultProducer is an OptionHandler,
159   * this string will represent those command line arguments required
160   * to set the ResultProducer to that state.
161   *
162   * @return the description of the ResultProducer state, or null
163   * if no state is defined
164   */
165  String getCompatibilityState();
166
167} // ResultProducer
Note: See TracBrowser for help on using the repository browser.