/// <summary> /// Initializes a new instance of the <see cref="NeuralNetworkEnsemble"/> class. /// Constructor /// </summary> /// <param name="networks"> /// An array of trained networks that will work as hash functions /// </param> /// <exception cref="NeuralNetworkHashingException"> /// Can not create a NN Ensemble out of no networks /// </exception> public NeuralNetworkEnsemble(Network[] networks) { if (networks == null || networks.Length == 0) { throw new NeuralNetworkHashingException("Can not create a NN Ensemble out of no networks"); } inputsCount = networks[0].InputCount; // Check all inputs foreach (Network network in networks) { if (network.InputCount != inputsCount) { throw new NeuralNetworkHashingException("All networks should have the same inputs count"); } if (network.MedianResponces == null) { throw new NeuralNetworkHashingException( "Median responses of one of the networks is null," + " please run Median Responses computation for each of the networks and try again"); } } this.networks = networks; foreach (Network network in this.networks) { totalOutputs += network.GetLayerNeuronCount(network.LayerCount - 1); } outputVector = new byte[totalOutputs]; }
protected override void Load() { base.Load(); _port = LoadPort(); _master = LoadMaster(); _networks = LoadNetworks(); _queen = new QueenAnt(this); }
private QueenAnt(AntConfig config) { _instance = this; _config = config; _port = LoadPort(); //LoadMaster(); _networks = LoadNetworks(); InitAnts(); AntPacketHandler.Init(); }
private void InitPopulation() { _population = new Network[_popSize]; for (int i = 0; i < _popSize; i++){ _population[i] = new Network(); } }