コード例 #1
0
        /// <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();
        }
コード例 #2
0
        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);
            }
        }