Example #1
0
 public void updateGUI() {
   if (jlist != null) {
     int enabled = this.enabled;
     jlist.clearSelection();
     for (int curindex = 0; curindex < size; curindex++) {
       if ((enabled & (1 << curindex)) != 0) {
         jlist.addSelectionInterval(curindex, curindex);
       }
     }
   }
 }
Example #2
0
  public void mouseDragged(MouseEvent e) {
    e.consume();

    // update selection
    int mouseDraggedRow = rowHeader.locationToIndex(e.getPoint());

    // make sure mouse pressed is initialized, this may not be the case
    // after closing the popup menu
    if (mousePressedRow < 0) {
      table.stopEditing();
      mousePressedRow = mouseDraggedRow;
    }
    if (AppD.isControlDown(e)) rowHeader.addSelectionInterval(mousePressedRow, mouseDraggedRow);
    else rowHeader.setSelectionInterval(mousePressedRow, mouseDraggedRow);
  }
 public void addSelectionInterval(int anchor, int lead) {
   super.addSelectionInterval(anchor, lead);
   int min = Math.min(anchor, lead);
   int max = Math.max(anchor, lead);
   table.setSelectedRows(min, max);
 }
Example #4
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();
  }
Example #5
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");

    // 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();
  }
Example #6
0
 public void hiliteActiveParticipant(String cname) {
   int i = plistModel.indexOf(cname);
   plist.addSelectionInterval(i, i);
 }