Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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);
			}
		}
Ejemplo n.º 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;
        }