## milk.experiment
Interface MIResultProducer

All Superinterfaces:
  java.io.Serializable

All Known Implementing Classes:
  MICrossValidationResultProducer, MIRandomSplitResultProducer

public interface MIResultProducer
extends java.io.Serializable

This interface defines the methods required for an object that produces results for different randomizations of a dataset.

Possible implementations of MIResultProducer:

- Random test/train splits
- CrossValidation splits
- LearningCurve splits (multiple results per run?)
- Averaging results of other result producers

Method Summary
`void` `doRun(int run)` Gets the results for a specified run number.
`void` `doRunKeys(int run)` Gets the keys for a specified run number.
`java.lang.String` `getCompatibilityState()` Gets a description of the internal settings of the result producer, sufficient for distinguishing a MIResultProducer instance from another with different settings (ignoring those settings set through this interface).
`java.lang.String[]` `getKeyNames()` Gets the names of each of the key columns produced for a single run.
`java.lang.Object[]` `getKeyTypes()` Gets the data types of each of the key columns produced for a single run.
`java.lang.String[]` `getResultNames()` Gets the names of each of the result columns produced for a single run.
`java.lang.Object[]` `getResultTypes()` Gets the data types of each of the result columns produced for a single run.
`void` `postProcess()` Perform any postprocessing.
`void` `preProcess()` Prepare to generate results.
`void` `setAdditionalMeasures(java.lang.String[] additionalMeasures)` Sets a list of method names for additional measures to look for in SplitEvaluators.
`void` `setInstances(Exemplars instances)` Sets the dataset that results will be obtained for.
`void` `setResultListener(MIResultListener listener)` Sets the object to send results of each run to.

Method Detail

### setInstances

    public void setInstances(Exemplars instances)

  Sets the dataset that results will be obtained for.

  Parameters:
    `instances` - a value of type 'Instances'.

### setResultListener

    public void setResultListener(MIResultListener listener)

  Sets the object to send results of each run to.

  Parameters:
    `listener` - a value of type 'ResultListener'

### setAdditionalMeasures

    public void setAdditionalMeasures(java.lang.String[] additionalMeasures)

  Sets a list of method names for additional measures to look for in SplitEvaluators.

  Parameters:
    `additionalMeasures` - a list of method names

### preProcess

    public void preProcess()
                    throws java.lang.Exception

  Prepare to generate results. The MIResultProducer should call preProcess(this) on the ResultListener it is to send results to.

  Throws:
    `java.lang.Exception` - if an error occurs during preprocessing.

### postProcess

    public void postProcess()
                     throws java.lang.Exception

  Perform any postprocessing. When this method is called, it indicates that no more requests to generate results for the current experiment will be sent. The MIResultProducer should call preProcess(this) on the ResultListener it is to send results to.

  Throws:
    `java.lang.Exception` - if an error occurs

### doRun

    public void doRun(int run)
               throws java.lang.Exception

  Gets the results for a specified run number. Different run numbers correspond to different randomizations of the data. Results produced should be sent to the current ResultListener, but only if the ResultListener says the result is required (it may already have that result). A single run may produce multiple results.

  Parameters:
    `run` - the run number to generate results for.
  Throws:
    `java.lang.Exception` - if a problem occurs while getting the results

### doRunKeys

    public void doRunKeys(int run)
                   throws java.lang.Exception

  Gets the keys for a specified run number. Different run numbers correspond to different randomizations of the data. Keys produced should be sent to the current ResultListener

  Parameters:
    `run` - the run number to get keys for.
  Throws:
    `java.lang.Exception` - if a problem occurs while getting the keys

### getKeyNames

    public java.lang.String[] getKeyNames()
                                   throws java.lang.Exception

  Gets the names of each of the key columns produced for a single run. The names should not contain spaces (use '_' instead for easy translation.)

  Returns:
    an array containing the name of each key column
  Throws:
    `java.lang.Exception` - if the key names could not be determined (perhaps because of a problem from a nested sub-resultproducer)

### getKeyTypes

    public java.lang.Object[] getKeyTypes()
                                   throws java.lang.Exception

  Gets the data types of each of the key columns produced for a single run.

  Returns:
    an array containing objects of the type of each key column. The objects should be Strings, or Doubles.
  Throws:
    `java.lang.Exception` - if the key types could not be determined (perhaps because of a problem from a nested sub-resultproducer)

### getResultNames

    public java.lang.String[] getResultNames()
                                      throws java.lang.Exception

  Gets the names of each of the result columns produced for a single run. The names should not contain spaces (use '_' instead for easy translation.)

  Returns:
    an array containing the name of each result column
  Throws:
    `java.lang.Exception` - if the result names could not be determined (perhaps because of a problem from a nested sub-resultproducer)

### getResultTypes

    public java.lang.Object[] getResultTypes()
                                      throws java.lang.Exception

  Gets the data types of each of the result columns produced for a single run.

  Returns:
    an array containing objects of the type of each result column. The objects should be Strings, or Doubles.
  Throws:
    `java.lang.Exception` - if the result types could not be determined (perhaps because of a problem from a nested sub-resultproducer)

### getCompatibilityState

    public java.lang.String getCompatibilityState()

  Gets a description of the internal settings of the result producer, sufficient for distinguishing a MIResultProducer instance from another with different settings (ignoring those settings set through this interface). For example, a cross-validation MIResultProducer may have a setting for the number of folds. For a given state, the results produced should be compatible. Typically if a MIResultProducer is an OptionHandler, this string will represent those command line arguments required to set the MIResultProducer to that state.

  Returns:
    the description of the MIResultProducer state, or null if no state is defined