public void setResultKeyFromDialog() { ListSelectorDialog jd = new ListSelectorDialog(null, m_ResultKeyList); // Open the dialog int result = jd.showDialog(); // If accepted, update the ttester if (result == ListSelectorDialog.APPROVE_OPTION) { int[] selected = m_ResultKeyList.getSelectedIndices(); String selectedList = ""; for (int i = 0; i < selected.length; i++) { selectedList += "," + (selected[i] + 1); } Range generatorRange = new Range(); if (selectedList.length() != 0) { try { generatorRange.setRanges(selectedList); } catch (Exception ex) { ex.printStackTrace(); System.err.println(ex.getMessage()); } } m_TTester.setResultsetKeyColumns(generatorRange); setTTester(); } }
/** * Sets up the panel with a new set of instances, attempting to guess the correct settings for * various columns. * * @param newInstances the new set of results. */ public void setInstances(Instances newInstances) { m_Instances = newInstances; m_TTester.setInstances(m_Instances); m_FromLab.setText("Got " + m_Instances.numInstances() + " results"); // Temporarily remove the configuration listener m_RunCombo.removeActionListener(m_ConfigureListener); // Do other stuff m_DatasetKeyModel.removeAllElements(); m_RunModel.removeAllElements(); m_ResultKeyModel.removeAllElements(); m_CompareModel.removeAllElements(); int datasetCol = -1; int runCol = -1; String selectedList = ""; String selectedListDataset = ""; // =============== BEGIN EDIT melville =============== boolean noise = false; // keep track of whether noise levels eval is required boolean learning = false; // keep track of whether learning curve eval is required boolean fraction = false; // keep track of whether fractions of datasets are provided for learning // the key on which to base the learning curves (either total instances or fraction) int learning_key = -1; boolean classificationTask = false; // used to determine if regression measures should be selected // =============== END EDIT melville =============== for (int i = 0; i < m_Instances.numAttributes(); i++) { String name = m_Instances.attribute(i).name(); m_DatasetKeyModel.addElement(name); m_RunModel.addElement(name); m_ResultKeyModel.addElement(name); m_CompareModel.addElement(name); // =============== BEGIN EDIT melville =============== // If learning curves were generated then treat each // dataset + pt combination as a different dataset if (name.toLowerCase().equals("key_noise_levels")) { // noise overrides learning curves - but treat noise levels // like pts on learning curve learning_key = i; learning = true; noise = true; // fraction = true; } else if (name.toLowerCase().equals("key_fraction_instances") && !noise) { // fraction overrides total_instances learning_key = i; learning = true; fraction = true; } else if (name.toLowerCase().equals("key_total_instances") && !learning) { learning_key = i; learning = true; } else // =============== END EDIT melville =============== if (name.toLowerCase().equals("key_dataset")) { m_DatasetKeyList.addSelectionInterval(i, i); selectedListDataset += "," + (i + 1); } else if ((runCol == -1) && (name.toLowerCase().equals("key_run"))) { m_RunCombo.setSelectedIndex(i); runCol = i; } else if (name.toLowerCase().equals("key_scheme") || name.toLowerCase().equals("key_scheme_options") || name.toLowerCase().equals("key_scheme_version_id")) { m_ResultKeyList.addSelectionInterval(i, i); selectedList += "," + (i + 1); // =============== BEGIN EDIT mbilenko =============== // automatic selection of the correct measure for clustering experiments } else if (name.toLowerCase().indexOf("pairwise_f_measure") != -1) { m_CompareCombo.setSelectedIndex(i); m_ErrorCompareCol = i; } // automatic selection of the correct measure for deduping experiments else if (name.toLowerCase().equals("precision")) { m_CompareCombo.setSelectedIndex(i); // =============== END EDIT mbilenko =============== } else if (name.toLowerCase().indexOf("percent_correct") != -1) { m_CompareCombo.setSelectedIndex(i); classificationTask = true; } else if (!classificationTask && (name.toLowerCase().indexOf("root_mean_squared_error") != -1)) { // automatic selection of the correct measure for regression experiments m_CompareCombo.setSelectedIndex(i); } else if (name.toLowerCase().indexOf("percent_incorrect") != -1) { m_ErrorCompareCol = i; // remember index of error for computing error reductions } } // =============== BEGIN EDIT melville =============== if (learning) { m_DatasetKeyList.addSelectionInterval(learning_key, learning_key); selectedListDataset += "," + (learning_key + 1); m_CompareModel.addElement("%Error_reduction"); m_CompareModel.addElement("Top_20%_%Error_reduction"); } // =============== END EDIT melville =============== if (runCol == -1) { runCol = 0; } m_DatasetKeyBut.setEnabled(true); m_RunCombo.setEnabled(true); m_ResultKeyBut.setEnabled(true); m_CompareCombo.setEnabled(true); // Reconnect the configuration listener m_RunCombo.addActionListener(m_ConfigureListener); // Set up the TTester with the new data m_TTester.setRunColumn(runCol); Range generatorRange = new Range(); if (selectedList.length() != 0) { try { generatorRange.setRanges(selectedList); } catch (Exception ex) { ex.printStackTrace(); System.err.println(ex.getMessage()); } } m_TTester.setResultsetKeyColumns(generatorRange); generatorRange = new Range(); if (selectedListDataset.length() != 0) { try { generatorRange.setRanges(selectedListDataset); } catch (Exception ex) { ex.printStackTrace(); System.err.println(ex.getMessage()); } } m_TTester.setDatasetKeyColumns(generatorRange); // =============== BEGIN EDIT melville =============== m_TTester.setLearningCurve(learning); m_TTester.setFraction(fraction); if (learning) { // get points on the learning curve Attribute attr; if (noise) { // override fraction attr = m_Instances.attribute("Key_Noise_levels"); } else if (fraction) { attr = m_Instances.attribute("Key_Fraction_instances"); } else { attr = m_Instances.attribute("Key_Total_instances"); } double[] pts = new double[attr.numValues()]; for (int k = 0; k < attr.numValues(); k++) { pts[k] = Double.parseDouble(attr.value(k)); } // sort points Arrays.sort(pts); m_TTester.setPoints(pts); } // =============== END EDIT melville =============== m_SigTex.setEnabled(true); m_PrecTex.setEnabled(true); setTTester(); }