public EchoStateNetwork commitChanges(){
  Network net=networkPanel.getNetwork();
  Integer numIns=Utils.parseInteger(tfInputLayerPop);
  if (numIns == null) {
    throw new IllegalArgumentException("Non-Number input population.");
  }
  NeuronGroup inputLayer=new NeuronGroup(net,numIns);
  if (inputLayer.size() > inputLayer.getGridThreshold()) {
    inputLayer.setLayout(new org.simbrain.network.layouts.GridLayout());
  }
  inputLayer.applyLayout();
  NeuronGroup reservoirLayer=reservoirPanel.createLayerFromData();
  if (reservoirLayer.size() > reservoirLayer.getGridThreshold()) {
    reservoirLayer.setLayout(new org.simbrain.network.layouts.GridLayout());
  }
  reservoirLayer.applyLayout();
  SynapseGroup resSynapses=resToResPanel.createSynapseGroup(reservoirLayer,reservoirLayer);
  resSynapses.setLabel("Res \u2192 Res");
  NeuronGroup outputLayer=outputPanel.createLayerFromData();
  outputLayer.applyLayout();
  if (outputLayer.size() > outputLayer.getGridThreshold()) {
    outputLayer.setLayout(new org.simbrain.network.layouts.GridLayout());
  }
  EchoStateNetwork esn=new EchoStateNetwork(net,networkPanel.getLastClickedPosition());
  esn.setBackWeights(allowOutToRes.isSelected());
  esn.setDirectInOutWeights(directInputToOutput.isSelected());
  esn.setRecurrentOutWeights(allowRecurrentOutputs.isSelected());
  esn.setTimeType((TimeType)cbTimeType.getSelectedItem());
  double maxEig=Utils.doubleParsable(spectralRadius);
  if (Double.isNaN(maxEig)) {
    throw new IllegalArgumentException("Non-Number spectral radius.");
  }
  esn.initializeInputLayer(inputLayer);
  esn.initializeReservoir(reservoirLayer,resSynapses,maxEig);
  esn.initializeOutput(outputLayer);
  SynapseGroup itr=inToResPanel.createSynapseGroup(inputLayer,reservoirLayer);
  itr.setLabel("In \u2192 Res");
  esn.addSynapseGroup(itr);
  SynapseGroup rto=SynapseGroup.createSynapseGroup(reservoirLayer,outputLayer,0.5);
  rto.setLabel("Res \u2192 Out");
  esn.addSynapseGroup(rto);
  if (allowRecurrentOutputs.isSelected()) {
    SynapseGroup oto=SynapseGroup.createSynapseGroup(outputLayer,outputLayer,0.5);
    oto.setLabel("Out \u2192 Out");
    esn.addSynapseGroup(oto);
  }
  if (allowOutToRes.isSelected()) {
    SynapseGroup otr=outToResPanel.createSynapseGroup(outputLayer,reservoirLayer);
    otr.setLabel("Out \u2192 Res.");
    esn.addSynapseGroup(otr);
  }
  if (directInputToOutput.isSelected()) {
    SynapseGroup ito=SynapseGroup.createSynapseGroup(inputLayer,outputLayer,0.5);
    ito.setLabel("In \u2192 Out");
    esn.addSynapseGroup(ito);
  }
  esn.positionLayers();
  return esn;
}

public EchoStateNetwork commitChanges ( ) { Network net = networkPanel . getNetwork ( ) ; Integer numIns = Utils . parseInteger ( tfInputLayerPop ) ; if ( numIns == null ) { throw new IllegalArgumentException ( "Non-Number input population." ) ; } NeuronGroup inputLayer = new NeuronGroup ( net , numIns ) ; if ( inputLayer . size ( ) > inputLayer . getGridThreshold ( ) ) { inputLayer . setLayout ( new org . simbrain . network . layouts . GridLayout ( ) ) ; } inputLayer . applyLayout ( ) ; NeuronGroup reservoirLayer = reservoirPanel . createLayerFromData ( ) ; if ( reservoirLayer . size ( ) > reservoirLayer . getGridThreshold ( ) ) { reservoirLayer . setLayout ( new org . simbrain . network . layouts . GridLayout ( ) ) ; } reservoirLayer . applyLayout ( ) ; SynapseGroup resSynapses = resToResPanel . createSynapseGroup ( reservoirLayer , reservoirLayer ) ; resSynapses . setLabel ( "Res → Res" ) ; NeuronGroup outputLayer = outputPanel . createLayerFromData ( ) ; outputLayer . applyLayout ( ) ; if ( outputLayer . size ( ) > outputLayer . getGridThreshold ( ) ) { outputLayer . setLayout ( new org . simbrain . network . layouts . GridLayout ( ) ) ; } EchoStateNetwork esn = new EchoStateNetwork ( net , networkPanel . getLastClickedPosition ( ) ) ; esn . setBackWeights ( allowOutToRes . isSelected ( ) ) ; esn . setDirectInOutWeights ( directInputToOutput . isSelected ( ) ) ; esn . setRecurrentOutWeights ( allowRecurrentOutputs . isSelected ( ) ) ; esn . setTimeType ( ( TimeType ) cbTimeType . getSelectedItem ( ) ) ; double maxEig = Utils . doubleParsable ( spectralRadius ) ; if ( Double . isNaN ( maxEig ) ) { throw new IllegalArgumentException ( "Non-Number spectral radius." ) ; } esn . initializeInputLayer ( inputLayer ) ; esn . initializeReservoir ( reservoirLayer , resSynapses , maxEig ) ; esn . initializeOutput ( outputLayer ) ; SynapseGroup itr = inToResPanel . createSynapseGroup ( inputLayer , reservoirLayer ) ; itr . setLabel ( "In → Res" ) ; esn . addSynapseGroup ( itr ) ; SynapseGroup rto = SynapseGroup . createSynapseGroup ( reservoirLayer , outputLayer , 0.5 ) ; rto . setLabel ( "Res → Out" ) ; esn . addSynapseGroup ( rto ) ; if ( allowRecurrentOutputs . isSelected ( ) ) { SynapseGroup oto = SynapseGroup . createSynapseGroup ( outputLayer , outputLayer , 0.5 ) ; oto . setLabel ( "Out → Out" ) ; esn . addSynapseGroup ( oto ) ; } if ( allowOutToRes . isSelected ( ) ) { SynapseGroup otr = outToResPanel . createSynapseGroup ( outputLayer , reservoirLayer ) ; otr . setLabel ( "Out → Res." ) ; esn . addSynapseGroup ( otr ) ; } if ( directInputToOutput . isSelected ( ) ) { SynapseGroup ito = SynapseGroup . createSynapseGroup ( inputLayer , outputLayer , 0.5 ) ; ito . setLabel ( "In → Out" ) ; esn . addSynapseGroup ( ito ) ; } esn . positionLayers ( ) ; return esn ; }
create an esn from the data entered in this panel .
