/// <summary> /// Propogates input through network (FeedForward). Updates example.predictions. /// </summary> public void PropogateInput(Example example) { AssertValidFeatures(example); Neuron.UnfeedAll(Neurons); int feature = 0; foreach (Neuron neuron in Inputs) { neuron.Value = example.Features[feature++]; neuron.Fed = true; } foreach (Neuron neuron in Constants) { neuron.Value = 1; neuron.Fed = true; } foreach (Neuron neuron in Neurons) { recur_FeedForward(neuron); } example.Predictions = Outputs.Select(o => o.Value).ToList(); }
private void PropogateErrors(Example example) { AssertValidLabels(example); Neuron.UnfeedAll(Neurons); int label = 0; foreach (Neuron neuron in Outputs) { neuron.UpdateErrorTerm(example.Labels[label++]); neuron.Fed = true; } foreach (Neuron neuron in Neurons) { recur_BackPropogation(neuron); } }