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); }
public FeedforwardNetwork CloneStructure() { var result = new FeedforwardNetwork(); foreach (var layer in Layers) { var clonedLayer = new FeedforwardLayer(layer.NeuronCount); result.AddLayer(clonedLayer); } return(result); }
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); } } }
public FeedforwardNetwork CloneStructure() { var result = new FeedforwardNetwork(); foreach (var layer in Layers) { var clonedLayer = new FeedforwardLayer(layer.NeuronCount); result.AddLayer(clonedLayer); } return result; }
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); } }
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; }