final int D = space.getFeatureSize();
final int L = space.getLabelSize();
final int N = space.getInstanceSize();
final int WS = D * L;
IntArrayList ys = space.getYs();
ArrayList<int[]> xs = space.getXs();
ArrayList<double[]> vs = space.getVs();
AbstractModel model = space.getModel();
double[] cWeights = new double[WS];
double[] aWeights = average ? new double[WS] : null;
double[] gs = new double[WS];
double stdev, prevScore, currScore = 0;
int[] indices = UTArray.range(N);
int i, j, correct, count = 1;
int yi;
int[] xi;
double[] vi = null;
for (i=0; i<MAX_ITER; i++)
{
UTArray.shuffle(new Random(5), indices, N);
prevScore = currScore;
Arrays.fill(gs, 0);
correct = 0;
for (j=0; j<N; j++)
{
yi = ys.get(indices[j]);
xi = xs.get(indices[j]);
if (space.hasWeight()) vi = vs.get(indices[j]);
if (average)
{