Beispiel #1
0
        public static float train_network(Network net, Data d)
        {
            int batch = net.Batch;
            int n     = d.X.Rows / batch;

            float[] x = new float[batch * d.X.Cols];
            float[] y = new float[batch * d.Y.Cols];

            int   i;
            float sum = 0;

            for (i = 0; i < n; ++i)
            {
                d.get_next_batch(batch, i * batch, x, y);
                float err = train_network_datum(net, x, y);
                sum += err;
            }
            return(sum / (n * batch));
        }