internal Training(NeuralNetwork Network, TrainingMode mode) : base(Network, DetermineIterationRepeatPars(Network)) { Contract.Requires(Network != null); Mode = mode; if (Mode == TrainingMode.Streamed && (GCAlgo != GradientComputingAlgorithm.RTLR || GCAlgo != GradientComputingAlgorithm.None)) { throw new InvalidOperationException("Only RTLR allowed for Streamed training. You have to use Recurrent NN with RTLR Algorithm in RecurrentOptions."); } if ((Network.StructuralElementFlags & NNStructuralElement.GradientInformation) != 0) { if (Network.IsRecurrent) { GCAlgo = Network.RecurrentOptions.Algorithm == RLAlgorithm.BPTT ? GradientComputingAlgorithm.BPTT : GradientComputingAlgorithm.RTLR; } else { GCAlgo = GradientComputingAlgorithm.BP; } } else { GCAlgo = GradientComputingAlgorithm.None; } }
public WeightedCombiner(NetworkMatrix weights, NetworkVector biases, TrainingMode mode) : base(mode) { if (weights == null) { throw new ArgumentException("Attempt to create a WeightedCombiner with null weights."); } if (biases == null) { throw new ArgumentException("Attempt to create a WeightedCombiner with null biases."); } if (biases.Dimension != weights.NumberOfOutputs) { throw new ArgumentException("Dimension of biases must the the same of the outputs."); } _weights = weights.Copy(); _biases = biases.Copy(); _inputs = new NetworkVector(NumberOfInputs); _outputs = new NetworkVector(NumberOfOutputs); _inputGradient = new NetworkVector(NumberOfInputs); }
internal Training(NeuralNetwork network, BufferAllocator allocator, TrainingMode mode) : base(network, DetermineIterationRepeat(network), allocator) { Contract.Requires(network != null); Contract.Requires(allocator != null); Mode = mode; if (Mode == TrainingMode.Streamed && (GCAlgo != GradientComputingAlgorithm.RTLR || GCAlgo != GradientComputingAlgorithm.None)) { throw new InvalidOperationException("Only RTLR allowed for Streamed training. You have to use Recurrent NN with RTLR Algorithm in RecurrentOptions."); } if ((network.StructuralElementFlags & NNStructuralElement.GradientInformation) != 0) { if (network.IsRecurrent) { GCAlgo = network.RecurrentOptions.Algorithm == RLAlgorithm.BPTT ? GradientComputingAlgorithm.BPTT : GradientComputingAlgorithm.RTLR; } else { GCAlgo = GradientComputingAlgorithm.BP; } } else { GCAlgo = GradientComputingAlgorithm.None; } if (GCAlgo == GradientComputingAlgorithm.BPTT) { savedErrorVectors = new ErrorVectorStack(network, allocator); } }
internal Training(NeuralNetwork network, TrainingMode mode) : base(network, DetermineIterationRepeatPars(network)) { Contract.Requires(network != null); Mode = mode; }
public void ToggleTrainingMode(int modeIndex) { TrainingMode selectedMode = (TrainingMode)modeIndex; if (!RemoveTrainingMode(selectedMode)) { AddTrainingMode(selectedMode); } }
public Layer(double[,] weights, double[] biases, TrainingMode mode) : base(mode) { int numberOfOutputs = weights.GetLength(0); int numberOfInputs = weights.GetLength(1); _combiner = new WeightedCombiner(weights, biases); _neuralFunction = null; }
public Layer( double[,] weights, double[] biases, ActivationFunction activationfunction, DerivativeFunction derivativefunction, TrainingMode mode) : this(weights, biases) { if (activationfunction != null && derivativefunction == null) { throw new ArgumentException("derivativefunction cannot be null, if activatioin is not null"); } _neuralFunction = new NeuralFunction(NumberOfOutputs, activationfunction, derivativefunction); }
public void AddTrainingMode(TrainingMode selectedMode) { selectedTrainingModes.Add(selectedMode); }
public bool RemoveTrainingMode(TrainingMode selectedMode) { return(selectedTrainingModes.Remove(selectedMode)); }
public bool CheckForSelectedMode(TrainingMode trainingMode) { return(selectedTrainingModes?.Contains(trainingMode) ?? false); }
private void MenuVMStartPracticeRequested(List <DictionaryEntry> dictionaryEntries) { _trainingMode = TrainingMode.Practice; _questionVM.Initialize(dictionaryEntries); Content = _questionVM; }
public void OnEventHandler(TrainingMode e) { trainMode = e.Active; }
public TrainableNetworkComponent(TrainingMode mode) { Mode = mode; }
protected TrainableNetworkComponent() { Mode = TrainingMode.ONLINE; }
private void MenuVMStartPracticeRequested(List<DictionaryEntry> dictionaryEntries) { _trainingMode = TrainingMode.Practice; _questionVM.Initialize(dictionaryEntries); Content = _questionVM; }
private void MenuVMStartCompetitionRequested(List<DictionaryEntry> dictionaryEntries) { _trainingMode = TrainingMode.Competition; _questionVM.Initialize(dictionaryEntries); Content = _questionVM; }