public DataTable createWeightsTable() {
   SimpleDataTable weightTable =
       new SimpleDataTable("Hyperplane Model Weights", new String[] {"Attribute", "Weight"});
   for (int j = 0; j < this.coefficientNames.length; j++) {
     int nameIndex = weightTable.mapString(0, this.coefficientNames[j]);
     weightTable.add(new SimpleDataTableRow(new double[] {nameIndex, this.coefficients[j]}));
   }
   return weightTable;
 }
  public static int fillDataTable(
      SimpleDataTable dataTable,
      Map<String, double[]> lastPopulation,
      Population pop,
      boolean drawDominated) {
    lastPopulation.clear();
    dataTable.clear();
    int numberOfCriteria = 0;
    for (int i = 0; i < pop.getNumberOfIndividuals(); i++) {
      boolean dominated = false;
      if (!drawDominated) {
        for (int j = 0; j < pop.getNumberOfIndividuals(); j++) {
          if (i == j) continue;
          if (NonDominatedSortingSelection.isDominated(pop.get(i), pop.get(j))) {
            dominated = true;
            break;
          }
        }
      }

      if (drawDominated || (!dominated)) {
        StringBuffer id = new StringBuffer(i + " (");
        PerformanceVector current = pop.get(i).getPerformance();
        numberOfCriteria = Math.max(numberOfCriteria, current.getSize());
        double[] data = new double[current.getSize()];
        for (int d = 0; d < data.length; d++) {
          data[d] = current.getCriterion(d).getFitness();
          if (d != 0) id.append(", ");
          id.append(Tools.formatNumber(data[d]));
        }
        id.append(")");
        dataTable.add(new SimpleDataTableRow(data, id.toString()));
        double[] weights = pop.get(i).getWeights();
        double[] clone = new double[weights.length];
        System.arraycopy(weights, 0, clone, 0, weights.length);
        lastPopulation.put(id.toString(), clone);
      }
    }
    return numberOfCriteria;
  }
  public void startVisualization(Object id) {
    double[] weights = lastPopulation.get(id);

    SimpleDataTable dataTable =
        new SimpleDataTable("Attribute Weights", new String[] {"Attribute", "Weight"});
    int a = 0;
    for (Attribute attribute : exampleSet.getAttributes()) {
      dataTable.add(
          new SimpleDataTableRow(
              new double[] {dataTable.mapString(0, attribute.getName()), weights[a++]}));
    }

    Component visualizationComponent = new DataTableViewer(dataTable);
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.getContentPane().setLayout(new BorderLayout());

    frame
        .getContentPane()
        .add(new ExtendedJScrollPane(visualizationComponent), BorderLayout.CENTER);
    frame.setSize(600, 400);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }