@Override
 public void resultChanged(LookupEvent le) {
   Lookup.Result r = (Lookup.Result) le.getSource();
   Collection c = r.allInstances();
   if (!c.isEmpty()) {
     dataset = (DataSet) c.iterator().next();
     datasetTextField.setEnabled(true);
     datasetTextField.setText(dataset.getLabel());
     graphTypeCombo.removeAllItems();
     if (nnet != null && dataset != null) {
       graphTypeCombo.addItem(new OutputSurface3D(nnet, dataset));
       graphTypeCombo.addItem(new ErrorSurface3D(nnet, dataset));
       graphTypeCombo.addItem(new OutputForAttributeSurface3D(nnet, dataset));
       graphTypeCombo.addItem(new ErrorForAttributeSurface3D(nnet, dataset));
       datasetRowCount = dataset.getRows().size();
       drawButton.setEnabled(true);
     }
   }
 }
  @Override
  public void learn(DataSet trainingSet) {

    for (int phase = 0; phase < 2; phase++) {
      for (int k = 0; k < iterations[phase]; k++) {
        Iterator<DataSetRow> iterator = trainingSet.iterator();
        while (iterator.hasNext() && !isStopped()) {
          DataSetRow trainingSetRow = iterator.next();
          learnPattern(trainingSetRow, nR[phase]);
        } // while
        currentIteration = k;
        // this.notifyChange();
        fireLearningEvent(new LearningEvent(this, LearningEventType.EPOCH_ENDED));
        if (isStopped()) return;
      } // for k
      learningRate = learningRate * 0.5;
    } // for phase
  }
 public ErrorSurface3D(NeuralNetwork nnet, DataSet dataset) {
   dataProvider3D = new ErrorDataProvider3D(dataset, nnet);
   dataSetRowCount = dataset.getRows().size();
   outputNeuronCount = nnet.getOutputsCount();
 }