public void initialize(NeuralNetwork nn) {
	List<ConnectionCandidate> ccs = new BreadthFirstOrderStrategy(nn, nn.getInputLayer()).order();
	for (ConnectionCandidate cc : ccs) {
	    if (cc.connection instanceof FullyConnected) {
		FullyConnected fc = (FullyConnected) cc.connection;
		if (Util.isBias(fc.getInputLayer())) {
		    if (biasDefaultValue != null) {
			fc.getWeights().forEach(i -> fc.getWeights().getElements()[i] = biasDefaultValue);
		    } else if (biasRandomInitializer != null) {
			biasRandomInitializer.initialize(fc.getWeights());
		    } else {
			randomInitializer.initialize(fc.getWeights());
		    }
		} else {
		    randomInitializer.initialize(fc.getWeights());
		}
	    } else if (cc.connection instanceof Conv2DConnection) {
		Conv2DConnection c = (Conv2DConnection) cc.connection;
		if (Util.isBias(c.getInputLayer())) {
		    if (biasDefaultValue != null) {
			c.getWeights().forEach(i -> c.getWeights().getElements()[i] = biasDefaultValue);
		    } else if (biasRandomInitializer != null) {
			biasRandomInitializer.initialize(c.getWeights());
		    } else {
			randomInitializer.initialize(c.getWeights());
		    }
		} else {
		    randomInitializer.initialize(c.getWeights());
		}
	    }
	}
    }