@@ -0,0 +1,1386 @@
+package org.deeplearning4j.spark.data;%0A%0Aimport org.apache.spark.api.java.JavaRDD;%0Aimport org.deeplearning4j.spark.BaseSparkTest;%0Aimport org.deeplearning4j.spark.util.SparkUtils;%0Aimport org.junit.Test;%0Aimport org.nd4j.linalg.api.ndarray.INDArray;%0Aimport org.nd4j.linalg.dataset.DataSet;%0Aimport org.nd4j.linalg.factory.Nd4j;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * Created by Alex on 06/01/2017.%0A */%0Apublic class TestShuffleExamples extends BaseSparkTest %7B%0A%0A    @Test%0A    public void testShuffle()%7B%0A        List%3CDataSet%3E list = new ArrayList%3C%3E();%0A        for( int i=0; i%3C10; i++ )%7B%0A            INDArray f = Nd4j.valueArrayOf(new int%5B%5D%7B10,1%7D, i);%0A            INDArray l = f.dup();%0A%0A            DataSet ds = new DataSet(f,l);%0A            list.add(ds);%0A        %7D%0A%0A        JavaRDD%3CDataSet%3E rdd = sc.parallelize(list);%0A%0A        JavaRDD%3CDataSet%3E shuffled = SparkUtils.shuffleExamples(rdd, 10, 10);%0A%0A        List%3CDataSet%3E shuffledList = shuffled.collect();%0A%0A        int totalExampleCount = 0;%0A        for(DataSet ds : shuffledList)%7B%0A            totalExampleCount += ds.getFeatures().length();%0A            System.out.println(Arrays.toString(ds.getFeatures().data().asFloat()));%0A%0A            assertEquals(ds.getFeatures(), ds.getLabels());%0A        %7D%0A%0A        assertEquals(100, totalExampleCount);%0A    %7D%0A%0A%7D%0A

Add test for spark shuffling