/// <summary> /// Constructor for network trainer /// </summary> /// <param name="network">Network which will be teached</param> /// <param name="useCache">Shall be used cahce?</param> protected NetworkTrainer(ILearnableNetwork network, bool useCache = true) { if (network == null) { network = CreateNetwork(useCache); } this.network = network; }
/// <summary> /// Constructor for Image Network Trainer /// </summary> /// <param name="network">Network which should learn</param> /// <param name="useCache">Shall be used cache if exists?</param> public ImageNetworkTrainer(ILearnableNetwork network, bool useCache) : base(network, useCache) { DigitImageLoader loader = new DigitImageLoader(DigitImageLoader.DefaultImagesPathTest, DigitImageLoader.DefaultLabelsPathTest); var data = loader.Load(); Inputs = new double[data.Count][]; for (int i = 0; i < data.Count; i++) { Inputs[i] = data[i].ToDoubleArray(); } Results = new double[data.Count][]; for (int i = 0; i < data.Count; i++) { Results[i] = new double[NumberOfOutputs]; Results[i][data[i].Label] = 1; } }
/// <summary> /// Constructor for <see cref="XorGateNetworkTrainer"/> /// </summary> /// <param name="network">Network which will be teached</param> public XorGateNetworkTrainer(ILearnableNetwork network) : base(network) { }
/// <summary> /// Constructor of And Gate Netowrk Trainer /// </summary> /// <param name="network">Netowork which will be teached</param> public AndGateNetworkTrainer(ref ILearnableNetwork network) : base(network) { }