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); }
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)); }
protected bool Equals(ConnectedNeuron other) { return Equals(_activationFunction, other._activationFunction) && _inputConnections.SequenceEqual( other._inputConnections); }