//Instance methods /// <summary> /// See the base. /// </summary> public override bool Equals(object obj) { if (obj == null) { return(false); } FeedForwardNetworkSettings cmpSettings = obj as FeedForwardNetworkSettings; if (!Equals(OutputLayerActivation, cmpSettings.OutputLayerActivation) || !Equals(OutputRange, cmpSettings.OutputRange) || HiddenLayerCollection.Count != cmpSettings.HiddenLayerCollection.Count || !Equals(TrainerCfg, cmpSettings.TrainerCfg) ) { return(false); } for (int i = 0; i < HiddenLayerCollection.Count; i++) { if (!HiddenLayerCollection[i].Equals(cmpSettings.HiddenLayerCollection[i])) { return(false); } } return(true); }
/// <summary> /// The deep copy constructor /// </summary> /// <param name="source">Source instance</param> public FeedForwardNetworkSettings(FeedForwardNetworkSettings source) { OutputLayerActivation = null; OutputRange = null; if (source.OutputLayerActivation != null) { OutputLayerActivation = ActivationFactory.DeepCloneActivationSettings(source.OutputLayerActivation); OutputRange = source.OutputRange.DeepClone(); } RegressionMethod = source.RegressionMethod; HiddenLayerCollection = new List <HiddenLayerSettings>(source.HiddenLayerCollection.Count); foreach (HiddenLayerSettings shls in source.HiddenLayerCollection) { HiddenLayerCollection.Add(shls.DeepClone()); } LinRegrTrainerCfg = null; RPropTrainerCfg = null; if (source.LinRegrTrainerCfg != null) { LinRegrTrainerCfg = source.LinRegrTrainerCfg.DeepClone(); } if (source.RPropTrainerCfg != null) { RPropTrainerCfg = source.RPropTrainerCfg.DeepClone(); } return; }
/// <summary> /// Instantiates an initialized feed forward network /// </summary> /// <param name="numOfInputValues">Number of network's input values</param> /// <param name="numOfOutputValues">Number of network's output values</param> /// <param name="settings">Configuration parameters</param> public FeedForwardNetwork(int numOfInputValues, int numOfOutputValues, FeedForwardNetworkSettings settings) : this(numOfInputValues, numOfOutputValues) { //Initialize FF network for (int i = 0; i < settings.HiddenLayerCollection.Count; i++) { AddLayer(settings.HiddenLayerCollection[i].NumOfNeurons, ActivationFactory.Create(settings.HiddenLayerCollection[i].Activation) ); } FinalizeStructure(ActivationFactory.Create(settings.OutputLayerActivation)); return; }
/// <summary> /// Creates the deep copy instance of this instance /// </summary> public FeedForwardNetworkSettings DeepClone() { FeedForwardNetworkSettings clone = new FeedForwardNetworkSettings(this); return(clone); }