Пример #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;
        }