alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (SamplingTest.java)

This example Java source code file (SamplingTest.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

datasetiterator, exception, mnistdatasetiterator, samplingtest, test

The SamplingTest.java Java example source code

package org.deeplearning4j.datasets.iterator;

import static org.junit.Assert.*;

import org.nd4j.linalg.dataset.api.iterator.DataSetIterator;
import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator;
import org.junit.Test;

/**
 * @author Adam Gibson
 */
public class SamplingTest {

    @Test
    public void testSample() throws Exception {
        DataSetIterator iter = new MnistDataSetIterator(10,10);
        //batch size and total
        DataSetIterator sampling = new SamplingDataSetIterator(iter.next(),10,10);
        assertEquals(sampling.next().numExamples(),10);
    }

}

Other Java examples (source code examples)

Here is a short list of links related to this Java SamplingTest.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.