/// <summary> /// Learn using the Manhattan update rule. /// </summary> /// /// <param name="learningRate">The learning rate.</param> public void LearnManhattan(double learningRate) { this.learningType = TrainFlatNetworkOpenCL.LEARN_MANHATTAN; this.learningRate = learningRate; IDictionary<String, String> options = GetOptions("LEARN_MANHATTAN"); this.kernel = new KernelNetworkTrain(this.profile.Device, this.network, this.training, 1); this.kernel.Compile(options, profile, this.network); this.kernel.TempDataArray[0] = (float)learningRate; }
/// <summary> /// Learn using RPROP with a custom initial update and max step. /// </summary> /// /// <param name="initialUpdate">The initial update value.</param> /// <param name="maxStep">The max step.</param> public void LearnRPROP(double initialUpdate, double maxStep) { this.learningType = TrainFlatNetworkOpenCL.LEARN_RPROP; this.initialUpdate = initialUpdate; this.maxStep = maxStep; IDictionary<String, String> options = GetOptions("LEARN_RPROP"); this.kernel = new KernelNetworkTrain(this.profile.Device, this.network, this.training, this.network.Weights.Length * 2); this.kernel.Compile(options, profile, this.network); int weightLength = this.network.Weights.Length; for (int i = 0; i < weightLength; i++) { this.kernel.TempDataArray[i] = 0; this.kernel.TempDataArray[i + weightLength] = (float)this.initialUpdate; } }
/// <summary> /// Learn using backpropagation. /// </summary> /// /// <param name="learningRate">The learning rate.</param> /// <param name="momentum">The momentum.</param> public void LearnBPROP(double learningRate, double momentum) { this.learningType = TrainFlatNetworkOpenCL.LEARN_BPROP; this.momentum = momentum; this.learningRate = learningRate; this.learningType = TrainFlatNetworkOpenCL.LEARN_BPROP; IDictionary<String, String> options = GetOptions("LEARN_BPROP"); this.kernel = new KernelNetworkTrain(this.profile.Device, this.network, this.training, this.network.Weights.Length + 2); this.kernel.Compile(options, profile, this.network); this.kernel.TempDataArray[0] = (float)learningRate; this.kernel.TempDataArray[1] = (float)momentum; }