private void refreshTable()
{
GuiUtils.removeAllRaws(coeficientsTable);
Network network = getLearningAlgorithm().getNetwork();
Metadata metadata = getLearningAlgorithm().getLearningData().getMetadata();
if (network.getLayers().size() > 0)
{
factorsScrollPane.setVisible(true);
componentIsNotEnabledPanel.setVisible(false);
int outputNeuronsCount = network.getLayers().getLast().getNeurons().size();
if (this.outputNeuronsCount == null || this.outputNeuronsCount != outputNeuronsCount)
{
List<Object> columnNames = new ArrayList<Object>();
List<ColumnInfo> outputColumns = metadata.resolveColumns(VariableType.OUT);
columnNames.add(Localizer.getString(StringId.INPUT));
List<String> dataOutputColumnNames = new ArrayList<String>();
for (ColumnInfo outputColumn : outputColumns)
{
if (outputColumn.getDataType().equals(DataType.Category))
{
for (String value : outputColumn.getValuesOfCategory())
{
dataOutputColumnNames.add(outputColumn.getName() + " - " + value);
}
}
else
{
dataOutputColumnNames.add(outputColumn.getName());
}
}
columnNames.addAll(dataOutputColumnNames);
columnNames.add(Localizer.getString(StringId.AVERAGE));
for (String dataOutputColumnName : dataOutputColumnNames)
{
columnNames.add(Localizer.getString(StringId.SELF_DESCRIPTIVENESS_SHORT) +
dataOutputColumnName);
}
columnNames.add(Localizer.getString(StringId.SELF_DESCRIPTIVENESS));
columnNames.add("|" + Localizer.getString(StringId.SELF_DESCRIPTIVENESS) + "|");
coeficientsTableModel.setColumnIdentifiers(columnNames.toArray());
coeficientsTable.getColumnModel().getColumn(0).setMinWidth(120);
GuiUtils.createDoubleComparatorForAllColumns(coeficientsTable);
GuiUtils.setCellRendererForAllColumns(coeficientsTable, coloredTableRenderer);
this.rowSorter = coeficientsTable.getRowSorter();
this.outputNeuronsCount = outputNeuronsCount;
}
List<Vector> rows = new ArrayList<Vector>();
double averageMin = Integer.MAX_VALUE;
double averageMax = Integer.MIN_VALUE;
List<ColumnInfo> inputColumns = metadata.resolveColumns(VariableType.IN);
for (int j = 0; j < inputColumns.size(); ++j)
{
Vector row = new Vector();
row.add(inputColumns.get(j).getName());
double sum = 0;
for (int i = 0; i < outputNeuronsCount; ++i)
{
Neuron neuron = network.getLayers().getLast().getNeurons().get(i);
double w = neuron.getInputSynapses().get(j).getWeight();
sum += w;
row.add(JNMFMathUtils.roundDouble4(w));