/** * Accepts results from a ResultProducer. * * @param rp the ResultProducer that generated the results * @param key an array of Objects (Strings or Doubles) that uniquely identify * a result for a given ResultProducer with given compatibilityState * @param result the results stored in an array. The objects stored in the * array may be Strings, Doubles, or null (for the missing value). * @throws Exception if the result could not be accepted. */ @Override public void acceptResult(ResultProducer rp, Object[] key, Object[] result) throws Exception { if (m_ResultProducer != rp) { throw new Error("Unrecognized ResultProducer sending results!!"); } // Add in current step as key field Object[] newKey = new Object[key.length + 1]; System.arraycopy(key, 0, newKey, 0, key.length); newKey[key.length] = new String("" + m_CurrentSize); // Pass on to result listener m_ResultListener.acceptResult(this, newKey, result); }
/** * Accepts results from a ResultProducer. * * @param rp the ResultProducer that generated the results * @param key an array of Objects (Strings or Doubles) that uniquely identify * a result for a given ResultProducer with given compatibilityState * @param result the results stored in an array. The objects stored in the * array may be Strings, Doubles, or null (for the missing value). * @throws Exception if the result could not be accepted. */ @Override public void acceptResult(ResultProducer rp, Object[] key, Object[] result) throws Exception { if (m_ResultProducer != rp) { throw new Error("Unrecognized ResultProducer sending results!!"); } // Add in current step as key field Object[] newKey = new Object[key.length + 1]; System.arraycopy(key, 0, newKey, 0, key.length); newKey[key.length] = new String("" + m_CurrentSize); // Pass on to result listener m_ResultListener.acceptResult(this, newKey, result); }
/** * 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 { // Generate the template Object[] template = determineTemplate(run); String[] newKey = new String[template.length - 1]; System.arraycopy(template, 0, newKey, 0, m_KeyIndex); System.arraycopy(template, m_KeyIndex + 1, newKey, m_KeyIndex, template.length - m_KeyIndex - 1); m_ResultListener.acceptResult(this, newKey, null); }
/** * 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 { // Generate the template Object[] template = determineTemplate(run); String[] newKey = new String[template.length - 1]; System.arraycopy(template, 0, newKey, 0, m_KeyIndex); System.arraycopy(template, m_KeyIndex + 1, newKey, m_KeyIndex, template.length - m_KeyIndex - 1); m_ResultListener.acceptResult(this, newKey, null); }
/** * 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_Instances == null) { throw new Exception("No Instances set"); } // Add in some fields to the key like run number, dataset name Object[] seKey = m_SplitEvaluator.getKey(); Object[] key = new Object[seKey.length + 2]; key[0] = Utils.backQuoteChars(m_Instances.relationName()); key[1] = "" + run; System.arraycopy(seKey, 0, key, 2, seKey.length); if (m_ResultListener.isResultRequired(this, key)) { try { m_ResultListener.acceptResult(this, key, null); } catch (Exception ex) { // Save the train and test datasets for debugging purposes? throw ex; } } }
/** * 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_Instances == null) { throw new Exception("No Instances set"); } // Add in some fields to the key like run number, dataset name Object[] seKey = m_SplitEvaluator.getKey(); Object[] key = new Object[seKey.length + 2]; key[0] = Utils.backQuoteChars(m_Instances.relationName()); key[1] = "" + run; System.arraycopy(seKey, 0, key, 2, seKey.length); if (m_ResultListener.isResultRequired(this, key)) { try { m_ResultListener.acceptResult(this, key, null); } catch (Exception ex) { // Save the train and test datasets for debugging purposes? throw ex; } } }
/** * 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_Instances == null) { throw new Exception("No Instances set"); } // Add in some fields to the key like run number, dataset name Object[] seKey = m_SplitEvaluator.getKey(); Object[] key = new Object[seKey.length + 2]; key[0] = Utils.backQuoteChars(m_Instances.relationName()); key[1] = "" + run; System.arraycopy(seKey, 0, key, 2, seKey.length); if (m_ResultListener.isResultRequired(this, key)) { try { m_ResultListener.acceptResult(this, key, null); } catch (Exception ex) { // Save the train and test datasets for debugging purposes? throw ex; } } }
/** * 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_Instances == null) { throw new Exception("No Instances set"); } // Add in some fields to the key like run number, dataset name Object[] seKey = m_SplitEvaluator.getKey(); Object[] key = new Object[seKey.length + 2]; key[0] = Utils.backQuoteChars(m_Instances.relationName()); key[1] = "" + run; System.arraycopy(seKey, 0, key, 2, seKey.length); if (m_ResultListener.isResultRequired(this, key)) { try { m_ResultListener.acceptResult(this, key, null); } catch (Exception ex) { // Save the train and test datasets for debugging purposes? throw ex; } } }
m_ResultListener.acceptResult(this, key, result);
/** * Determines whether the results for a specified key must be generated. * * @param rp the ResultProducer wanting to generate the results * @param key an array of Objects (Strings or Doubles) that uniquely identify * a result for a given ResultProducer with given compatibilityState * @return true if the result should be generated * @throws Exception if it could not be determined if the result is needed. */ @Override public boolean isResultRequired(ResultProducer rp, Object[] key) throws Exception { if (m_ResultProducer != rp) { throw new Error("Unrecognized ResultProducer sending results!!"); } // System.err.println("DBRP::isResultRequired"); // Is the result needed by the listener? boolean isRequiredByListener = m_ResultListener.isResultRequired(this, key); // Is the result already in the database? boolean isRequiredByDatabase = super.isResultRequired(rp, key); if (!isRequiredByDatabase && isRequiredByListener) { // Pass the result through to the listener Object[] result = getResultFromTable(m_ResultsTableName, rp, key); System.err.println("Got result from database: " + DatabaseUtils.arrayToString(result)); m_ResultListener.acceptResult(this, key, result); return false; } return (isRequiredByListener || isRequiredByDatabase); }
/** * 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_Instances == null) { throw new Exception("No Instances set"); } // Add in some fields to the key like run and fold number, dataset name Object[] seKey = m_SplitEvaluator.getKey(); Object[] key = new Object[seKey.length + 3]; key[0] = Utils.backQuoteChars(m_Instances.relationName()); key[2] = "" + (((run - 1) % m_NumFolds) + 1); key[1] = "" + (((run - 1) / m_NumFolds) + 1); System.arraycopy(seKey, 0, key, 3, seKey.length); if (m_ResultListener.isResultRequired(this, key)) { try { m_ResultListener.acceptResult(this, key, null); } catch (Exception ex) { // Save the train and test datasets for debugging purposes? throw ex; } } }
m_ResultListener.acceptResult(this, key, result);
/** * Determines whether the results for a specified key must be generated. * * @param rp the ResultProducer wanting to generate the results * @param key an array of Objects (Strings or Doubles) that uniquely identify * a result for a given ResultProducer with given compatibilityState * @return true if the result should be generated * @throws Exception if it could not be determined if the result is needed. */ @Override public boolean isResultRequired(ResultProducer rp, Object[] key) throws Exception { if (m_ResultProducer != rp) { throw new Error("Unrecognized ResultProducer sending results!!"); } // System.err.println("DBRP::isResultRequired"); // Is the result needed by the listener? boolean isRequiredByListener = m_ResultListener.isResultRequired(this, key); // Is the result already in the database? boolean isRequiredByDatabase = super.isResultRequired(rp, key); if (!isRequiredByDatabase && isRequiredByListener) { // Pass the result through to the listener Object[] result = getResultFromTable(m_ResultsTableName, rp, key); System.err.println("Got result from database: " + DatabaseUtils.arrayToString(result)); m_ResultListener.acceptResult(this, key, result); return false; } return (isRequiredByListener || isRequiredByDatabase); }
/** * 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_Instances == null) { throw new Exception("No Instances set"); } // Add in some fields to the key like run and fold number, dataset name Object[] seKey = m_SplitEvaluator.getKey(); Object[] key = new Object[seKey.length + 3]; key[0] = Utils.backQuoteChars(m_Instances.relationName()); key[2] = "" + (((run - 1) % m_NumFolds) + 1); key[1] = "" + (((run - 1) / m_NumFolds) + 1); System.arraycopy(seKey, 0, key, 3, seKey.length); if (m_ResultListener.isResultRequired(this, key)) { try { m_ResultListener.acceptResult(this, key, null); } catch (Exception ex) { // Save the train and test datasets for debugging purposes? throw ex; } } }
if (m_ResultListener.isResultRequired(this, key)) { try { m_ResultListener.acceptResult(this, key, null); } catch (Exception ex) {
if (m_ResultListener.isResultRequired(this, key)) { try { m_ResultListener.acceptResult(this, key, null); } catch (Exception ex) {
m_ZipDest.zipit(m_SplitEvaluator.getRawResultOutput(), resultName); m_ResultListener.acceptResult(this, key, results); } catch (Exception ex) {
m_ZipDest.zipit(m_SplitEvaluator.getRawResultOutput(), resultName); m_ResultListener.acceptResult(this, key, results); } catch (Exception ex) {
m_ZipDest.zipit(m_SplitEvaluator.getRawResultOutput(), resultName); m_ResultListener.acceptResult(this, key, results); } catch (Exception ex) {
m_ZipDest.zipit(m_SplitEvaluator.getRawResultOutput(), resultName); m_ResultListener.acceptResult(this, key, results); } catch (Exception e) {