/**
   * Generate the network.
   *
   * @return The generated network.
   */
  public BasicNetwork generate() {

    Layer input, instar, outstar;
    int y = PatternConst.START_Y;

    final BasicNetwork network = new BasicNetwork();
    network.addLayer(input = new BasicLayer(new ActivationLinear(), false, this.inputCount));
    network.addLayer(instar = new BasicLayer(new ActivationCompetitive(), false, this.instarCount));
    network.addLayer(outstar = new BasicLayer(new ActivationLinear(), false, this.outstarCount));
    network.getStructure().finalizeStructure();
    network.reset();

    input.setX(PatternConst.START_X);
    input.setY(y);
    y += PatternConst.INC_Y;

    instar.setX(PatternConst.START_X);
    instar.setY(y);
    y += PatternConst.INC_Y;

    outstar.setX(PatternConst.START_X);
    outstar.setY(y);

    // tag as needed
    network.tagLayer(BasicNetwork.TAG_INPUT, input);
    network.tagLayer(BasicNetwork.TAG_OUTPUT, outstar);
    network.tagLayer(CPNPattern.TAG_INSTAR, instar);
    network.tagLayer(CPNPattern.TAG_OUTSTAR, outstar);

    return network;
  }
Beispiel #2
0
 /**
  * Generate the RSOM network.
  *
  * @return The neural network.
  */
 public BasicNetwork generate() {
   final Layer input = new BasicLayer(new ActivationLinear(), false, this.inputNeurons);
   final Layer output = new BasicLayer(new ActivationLinear(), false, this.outputNeurons);
   int y = PatternConst.START_Y;
   final BasicNetwork network = new BasicNetwork(new SOMLogic());
   network.addLayer(input);
   network.addLayer(output);
   input.setX(PatternConst.START_X);
   output.setX(PatternConst.START_X);
   input.setY(y);
   y += PatternConst.INC_Y;
   output.setY(y);
   network.getStructure().finalizeStructure();
   network.reset();
   return network;
 }