コード例 #1
0
 protected void Setup()
 {
     var firstNeuron = new InputNeuron();
     var second = new ConnectedNeuron(ActivationFunctions.Linear, new[] {new Connection(firstNeuron, 2)});
     var third = new ConnectedNeuron(ActivationFunctions.Linear, new[] { new Connection(firstNeuron, 5)});
     var inputLayer = new InputLayer(new[] {firstNeuron});
     var kohonenLayer = new InnerLayer(new[] {second, third});
     Network = new KohonenNetwork(inputLayer,kohonenLayer);
     Directory.CreateDirectory(TestFolder);
 }
コード例 #2
0
        public void EqualsTest()
        {
            var firstNeuron = new InputNeuron();
            var second = new ConnectedNeuron(ActivationFunctions.Linear, new[] { new Connection(firstNeuron, 2) });
            var third = new ConnectedNeuron(ActivationFunctions.Linear, new[] { new Connection(firstNeuron, 5) });
            var inputLayer = new InputLayer(new[] { firstNeuron });
            var kohonenLayer = new InnerLayer(new[] { second, third });
            var firstNetwork = new KohonenNetwork(inputLayer, kohonenLayer);

            firstNeuron = new InputNeuron();
            second = new ConnectedNeuron(ActivationFunctions.Linear, new[] { new Connection(firstNeuron, 2) });
            third = new ConnectedNeuron(ActivationFunctions.Linear, new[] { new Connection(firstNeuron, 5) });
            inputLayer = new InputLayer(new[] { firstNeuron });
            kohonenLayer = new InnerLayer(new[] { second, third });

            var secondNetwork = new KohonenNetwork(inputLayer, kohonenLayer);

            Assert.True(firstNetwork.Equals(secondNetwork));
        }
コード例 #3
0
 protected bool Equals(ConnectedNeuron other)
 {
     return Equals(_activationFunction, other._activationFunction) &&
         _inputConnections.SequenceEqual( other._inputConnections);
 }