This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page. class


Add mini-batch support to datastore


MiniBatchable is an abstract mixin class that adds support for mini-batches to your custom datastore for use with Neural Network Toolbox™. A mini-batch datastore contains training and test data sets for use in network training, prediction, and classification.

To use this mixin class, you must inherit from the MiniBatchable class in addition to inheriting from the Datastore base class. Type the following syntax as the first line of your class definition file.

classdef MyDatastore < & ...

To add support for mini-batches to your datastore:

  • Inherit from an additional class MiniBatchable

  • Define two additional properties: MiniBatchSize and NumObservations.

For more details and steps to create your custom mini-batch datastore to optimize performance during training, prediction, and classification, see Develop Custom Mini-Batch Datastore.


expand all

Number of observations that are returned in each batch, or call of the read function. For training, prediction, and classification, the MiniBatchSize property is set to the mini-batch size defined in trainingOptions.



Total number of observations contained within the datastore. This number of observations is the length of one training epoch.





For information on class attributes, see Class Attributes (MATLAB).

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).

Alternative Functionality

You can use built-in mini-batch datastores to perform specific image preprocessing operations on each batch of data. For more information, see Advanced Image Preprocessing.

Introduced in R2018a

Was this topic helpful?