예제 #1
0
        public bool Equals(FeedforwardNetwork other)
        {
            var i = 0;

            foreach (var layer in Layers)
            {
                var otherLayer = other.Layers[i++];
                if (layer.NeuronCount != otherLayer.NeuronCount)
                {
                    return(false);
                }

                // make sure they either both have or do not have matrix weight matrix.
                if ((layer.LayerMatrix == null) && (otherLayer.LayerMatrix != null))
                {
                    return(false);
                }

                if ((layer.LayerMatrix != null) && (otherLayer.LayerMatrix == null))
                {
                    return(false);
                }

                // if they both have matrix matrix, then compare the matrices
                if ((layer.LayerMatrix != null) && (otherLayer.LayerMatrix != null))
                {
                    if (!layer.LayerMatrix.Equals(otherLayer.LayerMatrix))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
예제 #2
0
        public FeedforwardNetwork CloneStructure()
        {
            var result = new FeedforwardNetwork();

            foreach (var layer in Layers)
            {
                var clonedLayer = new FeedforwardLayer(layer.NeuronCount);
                result.AddLayer(clonedLayer);
            }
            return(result);
        }
예제 #3
0
        public static void ArrayToNetwork(Double[] array, FeedforwardNetwork network)
        {
            var index = 0;

            foreach (var layer in network.Layers)
            {
                if (layer.Next != null)
                {
                    index = layer.LayerMatrix.FromPackedArray(array, index);
                }
            }
        }
예제 #4
0
		public FeedforwardNetwork CloneStructure()
        {
            var result = new FeedforwardNetwork();
			foreach (var layer in Layers)
            {
                var clonedLayer = new FeedforwardLayer(layer.NeuronCount);
                result.AddLayer(clonedLayer);
            }
			return result;
        }
예제 #5
0
		public static void ArrayToNetwork(Double[] array, FeedforwardNetwork network)
		{
			var index = 0;
			foreach (var layer in network.Layers)
			{
				if (layer.Next != null)
					index = layer.LayerMatrix.FromPackedArray(array, index);
			}
		}
예제 #6
0
        public bool Equals(FeedforwardNetwork other)
        {
            var i = 0;
            foreach (var layer in Layers)
            {
                var otherLayer = other.Layers[i++];
                if (layer.NeuronCount != otherLayer.NeuronCount)
                    return false;

                // make sure they either both have or do not have matrix weight matrix.
                if ((layer.LayerMatrix == null) && (otherLayer.LayerMatrix != null))
                    return false;

                if ((layer.LayerMatrix != null) && (otherLayer.LayerMatrix == null))
                    return false;

                // if they both have matrix matrix, then compare the matrices
                if ((layer.LayerMatrix != null) && (otherLayer.LayerMatrix != null))
                {
                    if (!layer.LayerMatrix.Equals(otherLayer.LayerMatrix))
                        return false;
                }
            }
			return true;
        }