Exemplo n.º 1
0
        public IEnumerable <TrainingBatchCollection> AsBatches(int batchsize)
        {
            if (batchsize < 1)
            {
                throw new ArgumentException("Attempt to creat batches with < 1 elements each.");
            }

            int count = 0;
            TrainingBatchCollection workingCollection = new TrainingBatchCollection();

            foreach (BatchPair pair in this)
            {
                if (count == batchsize)
                {
                    yield return(workingCollection);

                    workingCollection.Clear();
                    count = 0;
                }

                workingCollection.Add(pair);
                count++;
            }

            yield return(workingCollection);
        }
Exemplo n.º 2
0
 public void Train(TrainingBatchCollection trainingdata)
 {
     _costAccumulator = 0;
     foreach (BatchPair tv in trainingdata)
     {
         _runAndBackPropagate(tv);
     }
     _component.Update(_strategy);
 }