/** * 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); }
/** * Set the value of KeyFieldName. * * @param newKeyFieldName Value to assign to KeyFieldName. */ public void setKeyFieldName(String newKeyFieldName) { m_KeyFieldName = newKeyFieldName; m_CountFieldName = "Num_" + m_KeyFieldName; findKeyIndex(); }
options[current++] = "" + getKeyFieldName(); options[current++] = "-X"; options[current++] = "" + getExpectedResultsPerAverage(); if (getCalculateStdDevs()) { options[current++] = "-S"; if (getResultProducer() != null) { options[current++] = "-W"; options[current++] = getResultProducer().getClass().getName();
/** * 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 = // "-F " + Utils.quote(getKeyFieldName()) " -X " + getExpectedResultsPerAverage() + " "; if (getCalculateStdDevs()) { result += "-S "; } if (m_ResultProducer == null) { result += "<null ResultProducer>"; } else { result += "-W " + m_ResultProducer.getClass().getName(); result += " -- " + m_ResultProducer.getCompatibilityState(); } return result.trim(); }
Object[] template = determineTemplate(run); String[] newKey = new String[template.length - 1]; System.arraycopy(template, 0, newKey, 0, m_KeyIndex); checkForMultipleDifferences(); checkForDuplicateKeys(template); doAverageResult(template);
stats[i] = new Stats(); Object[] result = getResultTypes(); int numMatches = 0; for (int i = 0; i < m_Keys.size(); i++) { Object[] currentKey = m_Keys.get(i); if (!matchesTemplate(template, currentKey)) { continue; result[k++] = null; if (getCalculateStdDevs()) { if (stats[j] != null) { result[k++] = new Double(stats[j].stdDev);
/** * 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; }
if (getCalculateStdDevs()) { int numNumeric = 0; for (Object resultType : resultTypes) {
/** * Gets a text descrption of the result producer. * * @return a text description of the result producer. */ @Override public String toString() { String result = "AveragingResultProducer: "; result += getCompatibilityState(); if (m_Instances == null) { result += ": <null Instances>"; } else { result += ": " + Utils.backQuoteChars(m_Instances.relationName()); } return result; }
GenericObjectEditor.registerEditors(); Object rp = new weka.experiment.AveragingResultProducer(); final PropertySelectorDialog jd = new PropertySelectorDialog(null, rp); int result = jd.showDialog();
Object[] template = determineTemplate(run); String[] newKey = new String[template.length - 1]; System.arraycopy(template, 0, newKey, 0, m_KeyIndex); checkForMultipleDifferences(); checkForDuplicateKeys(template); doAverageResult(template);
stats[i] = new Stats(); Object[] result = getResultTypes(); int numMatches = 0; for (int i = 0; i < m_Keys.size(); i++) { Object[] currentKey = m_Keys.get(i); if (!matchesTemplate(template, currentKey)) { continue; result[k++] = null; if (getCalculateStdDevs()) { if (stats[j] != null) { result[k++] = new Double(stats[j].stdDev);
/** * 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; }
/** * 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 = // "-F " + Utils.quote(getKeyFieldName()) " -X " + getExpectedResultsPerAverage() + " "; if (getCalculateStdDevs()) { result += "-S "; } if (m_ResultProducer == null) { result += "<null ResultProducer>"; } else { result += "-W " + m_ResultProducer.getClass().getName(); result += " -- " + m_ResultProducer.getCompatibilityState(); } return result.trim(); }
if (getCalculateStdDevs()) { int numNumeric = 0; for (Object resultType : resultTypes) {
/** * Gets a text descrption of the result producer. * * @return a text description of the result producer. */ @Override public String toString() { String result = "AveragingResultProducer: "; result += getCompatibilityState(); if (m_Instances == null) { result += ": <null Instances>"; } else { result += ": " + Utils.backQuoteChars(m_Instances.relationName()); } return result; }
GenericObjectEditor.registerEditors(); Object rp = new weka.experiment.AveragingResultProducer(); final PropertySelectorDialog jd = new PropertySelectorDialog(null, rp); int result = jd.showDialog();
options[current++] = "" + getKeyFieldName(); options[current++] = "-X"; options[current++] = "" + getExpectedResultsPerAverage(); if (getCalculateStdDevs()) { options[current++] = "-S"; if (getResultProducer() != null) { options[current++] = "-W"; options[current++] = getResultProducer().getClass().getName();
/** * Set the value of KeyFieldName. * * @param newKeyFieldName Value to assign to KeyFieldName. */ public void setKeyFieldName(String newKeyFieldName) { m_KeyFieldName = newKeyFieldName; m_CountFieldName = "Num_" + m_KeyFieldName; findKeyIndex(); }
if (getCalculateStdDevs()) { Object[] resultTypes = m_ResultProducer.getResultTypes(); int numNumeric = 0;