/** * 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 * * @param run the run number to get results for. * @throws Exception if a problem occurs while getting the results */ @Override public void doRun(int run) throws Exception { if (m_ResultProducer == null) { throw new Exception("No ResultProducer set"); } if (m_ResultListener == null) { throw new Exception("No ResultListener set"); } if (m_Instances == null) { throw new Exception("No Instances set"); } // Tell the resultproducer to send results to us m_ResultProducer.setResultListener(this); m_ResultProducer.setInstances(m_Instances); m_ResultProducer.doRun(run); }
/** * 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 * * @param run the run number to get keys for. * @throws Exception if a problem occurs while getting the keys */ @Override public void doRunKeys(int run) throws Exception { if (m_ResultProducer == null) { throw new Exception("No ResultProducer set"); } if (m_ResultListener == null) { throw new Exception("No ResultListener set"); } if (m_Instances == null) { throw new Exception("No Instances set"); } // Tell the resultproducer to send results to us m_ResultProducer.setResultListener(this); m_ResultProducer.setInstances(m_Instances); m_ResultProducer.doRunKeys(run); }
/** * Gets the names of each of the columns produced for a single run. * * @return an array containing the name of each column * @throws Exception if something goes wrong. */ @Override public String[] getKeyNames() throws Exception { return m_ResultProducer.getKeyNames(); }
/** * Prepare to generate results. The ResultProducer should call * preProcess(this) on the ResultListener it is to send results to. * * @throws Exception if an error occurs during preprocessing. */ @Override public void preProcess() throws Exception { if (m_ResultProducer == null) { throw new Exception("No ResultProducer set"); } m_ResultProducer.setResultListener(this); m_ResultProducer.preProcess(); }
String[] names = rp.getKeyNames(); Object[] types = rp.getKeyTypes(); if (names.length != types.length) { throw new Exception("key names types differ in length"); names = rp.getResultNames(); types = rp.getResultTypes(); if (names.length != types.length) { throw new Exception("result names and types differ in length"); query = "CREATE UNIQUE INDEX Key_IDX ON " + tableName + " ("; String[] keyNames = rp.getKeyNames();
/** * Prints the names of each field out as the first row of the CSV output. * * @param rp the ResultProducer generating our results. * @throws Exception if the field names could not be determined. */ private void printResultNames(ResultProducer rp) throws Exception { String[] key = rp.getKeyNames(); for (int i = 0; i < key.length; i++) { if (i != 0) { m_Out.print(','); } if (key[i] == null) { m_Out.print("?"); } else { m_Out.print("Key_" + key[i].toString()); } } String[] result = rp.getResultNames(); for (String element : result) { m_Out.print(','); if (element == null) { m_Out.print("?"); } else { m_Out.print(element.toString()); } } m_Out.println(""); }
m_ResultProducer.setResultListener(m_ResultListener); m_ResultProducer.setAdditionalMeasures(m_AdditionalMeasures); m_ResultProducer.preProcess(); m_ResultProducer.setAdditionalMeasures(columnConstraints);
/** * Gets a description of the internal settings of the result producer, * sufficient for distinguishing a ResultProducer instance from another with * different settings (ignoring those settings set through this interface). * For example, a cross-validation ResultProducer may have a setting for the * number of folds. For a given state, the results produced should be * compatible. Typically if a ResultProducer is an OptionHandler, this string * will represent the command line arguments required to set the * ResultProducer to that state. * * @return the description of the ResultProducer state, or null if no state is * defined */ @Override public String getCompatibilityState() { String result = ""; if (m_ResultProducer == null) { result += "<null ResultProducer>"; } else { result += "-W " + m_ResultProducer.getClass().getName(); result += " -- " + m_ResultProducer.getCompatibilityState(); } return result.trim(); }
/** * When this method is called, it indicates that no more requests to generate * results for the current experiment will be sent. The ResultProducer should * call preProcess(this) on the ResultListener it is to send results to. * * @throws Exception if an error occurs */ @Override public void postProcess() throws Exception { m_ResultProducer.postProcess(); }
/** * Gets the data types of each of the columns produced for a single run. * * @return an array containing objects of the type of each column. The objects * should be Strings, or Doubles. * @throws Exception if something goes wrong. */ @Override public Object[] getResultTypes() throws Exception { return m_ResultProducer.getResultTypes(); }
/** * Simulates a run to collect the keys the sub-resultproducer could generate. * Does some checking on the keys and determines the template key. * * @param run the run number * @return a template key (null for the field being averaged) * @throws Exception if an error occurs */ protected Object[] determineTemplate(int run) throws Exception { if (m_Instances == null) { throw new Exception("No Instances set"); } m_ResultProducer.setInstances(m_Instances); // Clear the collected results m_Keys.clear(); m_Results.clear(); m_ResultProducer.doRunKeys(run); checkForMultipleDifferences(); Object[] template = m_Keys.get(0).clone(); template[m_KeyIndex] = null; // Check for duplicate keys checkForDuplicateKeys(template); return template; }
m_ResultProducer.setInstances(m_CurrentInstances); m_ResultProducer.doRun(m_RunNumber);
Object[] keyTypes = m_RP.getKeyTypes(); Object[] resultTypes = m_RP.getResultTypes();
public String[] getResultNames() throws Exception { String[] resultNames = m_ResultProducer.getResultNames(); Object[] resultTypes = m_ResultProducer.getResultTypes(); int numNumeric = 0; for (Object resultType : resultTypes) {
/** * Gets the data types of each of the columns produced for a single run. This * method should really be static. * * @return an array containing objects of the type of each column. The objects * should be Strings, or Doubles. * @throws Exception if something goes wrong. */ @Override public Object[] getKeyTypes() throws Exception { return m_ResultProducer.getKeyTypes(); }
/** * Set a list of method names for additional measures to look for in * SplitEvaluators. This could contain many measures (of which only a subset * may be produceable by the current resultProducer) if an experiment is the * type that iterates over a set of properties. * * @param additionalMeasures an array of measure names, null if none */ @Override public void setAdditionalMeasures(String[] additionalMeasures) { m_AdditionalMeasures = additionalMeasures; if (m_ResultProducer != null) { System.err.println("AveragingResultProducer: setting additional " + "measures for " + "ResultProducer"); m_ResultProducer.setAdditionalMeasures(m_AdditionalMeasures); } }
/** * Gets the names of each of the columns produced for a single run. A new * result field is added for the number of results used to produce each * average. If only averages are being produced the names are not altered, if * standard deviations are produced then "Dev_" and "Avg_" are prepended to * each result deviation and average field respectively. * * @return an array containing the name of each column * @throws Exception if the result names could not be determined (perhaps * because of a problem from a nested sub-resultproducer) */ @Override public String[] getResultNames() throws Exception { return m_ResultProducer.getResultNames(); }
m_Results.clear(); m_ResultProducer.doRun(run);
String[] names = rp.getKeyNames(); Object[] types = rp.getKeyTypes(); if (names.length != types.length) { throw new Exception("key names types differ in length"); names = rp.getResultNames(); types = rp.getResultTypes(); if (names.length != types.length) { throw new Exception("result names and types differ in length"); query = "CREATE UNIQUE INDEX Key_IDX ON " + tableName + " ("; String[] keyNames = rp.getKeyNames();
/** * Prepare to generate results. The ResultProducer should call * preProcess(this) on the ResultListener it is to send results to. * * @throws Exception if an error occurs during preprocessing. */ @Override public void preProcess() throws Exception { if (m_ResultProducer == null) { throw new Exception("No ResultProducer set"); } m_ResultProducer.setResultListener(this); m_ResultProducer.preProcess(); }