예제 #1
0
 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;
 }
예제 #2
0
  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);
  }