Beispiel #1
0
  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();
    }
  }
Beispiel #2
0
  /** Swaps the keys for dataset and result. */
  protected void swapDatasetKeyAndResultKey() {
    int[] tmpSelected;
    Range tmpRange;

    // lists
    tmpSelected = m_DatasetKeyList.getSelectedIndices();
    m_DatasetKeyList.setSelectedIndices(m_ResultKeyList.getSelectedIndices());
    m_ResultKeyList.setSelectedIndices(tmpSelected);

    // tester
    tmpRange = m_TTester.getDatasetKeyColumns();
    m_TTester.setDatasetKeyColumns(m_TTester.getResultsetKeyColumns());
    m_TTester.setResultsetKeyColumns(tmpRange);
    setTTester();
  }
Beispiel #3
0
  /**
   * 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");

    // setup row and column names
    Vector rows = determineColumnNames(ExperimenterDefaults.getRow(), "Key_Dataset", m_Instances);
    Vector cols =
        determineColumnNames(
            ExperimenterDefaults.getColumn(),
            "Key_Scheme,Key_Scheme_options,Key_Scheme_version_ID",
            m_Instances);

    // Do other stuff
    m_DatasetKeyModel.removeAllElements();
    m_ResultKeyModel.removeAllElements();
    m_CompareModel.removeAllElements();
    m_SortModel.removeAllElements();
    m_SortModel.addElement("<default>");
    m_TTester.setSortColumn(-1);
    String selectedList = "";
    String selectedListDataset = "";
    boolean comparisonFieldSet = false;
    for (int i = 0; i < m_Instances.numAttributes(); i++) {
      String name = m_Instances.attribute(i).name();
      if (name.toLowerCase().startsWith("key_", 0)) {
        m_DatasetKeyModel.addElement(name.substring(4));
        m_ResultKeyModel.addElement(name.substring(4));
        m_CompareModel.addElement(name.substring(4));
      } else {
        m_DatasetKeyModel.addElement(name);
        m_ResultKeyModel.addElement(name);
        m_CompareModel.addElement(name);
        if (m_Instances.attribute(i).isNumeric()) m_SortModel.addElement(name);
      }

      if (rows.contains(name.toLowerCase())) {
        m_DatasetKeyList.addSelectionInterval(i, i);
        selectedListDataset += "," + (i + 1);
      } else if (name.toLowerCase().equals("key_run")) {
        m_TTester.setRunColumn(i);
      } else if (name.toLowerCase().equals("key_fold")) {
        m_TTester.setFoldColumn(i);
      } else if (cols.contains(name.toLowerCase())) {
        m_ResultKeyList.addSelectionInterval(i, i);
        selectedList += "," + (i + 1);
      } else if (name.toLowerCase().indexOf(ExperimenterDefaults.getComparisonField()) != -1) {
        m_CompareCombo.setSelectedIndex(i);
        comparisonFieldSet = true;
        //	break;
      } else if ((name.toLowerCase().indexOf("root_relative_squared_error") != -1)
          && (!comparisonFieldSet)) {
        m_CompareCombo.setSelectedIndex(i);
        comparisonFieldSet = true;
      }
    }
    m_TesterClasses.setEnabled(true);
    m_DatasetKeyBut.setEnabled(true);
    m_ResultKeyBut.setEnabled(true);
    m_SwapDatasetKeyAndResultKeyBut.setEnabled(true);
    m_CompareCombo.setEnabled(true);
    m_SortCombo.setEnabled(true);
    if (ExperimenterDefaults.getSorting().length() != 0)
      setSelectedItem(m_SortCombo, ExperimenterDefaults.getSorting());

    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);

    m_SigTex.setEnabled(true);

    setTTester();
  }