Package org.tribuo.datasource
Class IDXDataSource<T extends Output<T>>
java.lang.Object
org.tribuo.datasource.IDXDataSource<T>
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<DataSourceProvenance>
,Iterable<Example<T>>
,ConfigurableDataSource<T>
,DataSource<T>
public final class IDXDataSource<T extends Output<T>>
extends Object
implements ConfigurableDataSource<T>
A DataSource which can read IDX formatted data (i.e., MNIST).
Transparently reads GZipped files.
The file format is defined here.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Java side representation for an IDX file.static final class
Provenance class forIDXDataSource
.static enum
The possible IDX input formats. -
Constructor Summary
ConstructorDescriptionIDXDataSource
(Path featuresPath, Path outputPath, OutputFactory<T> outputFactory) Constructs an IDXDataSource from the supplied paths. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
IDXDataSource
public IDXDataSource(Path featuresPath, Path outputPath, OutputFactory<T> outputFactory) throws IOException Constructs an IDXDataSource from the supplied paths.- Parameters:
featuresPath
- The path to the features file.outputPath
- The path to the output file.outputFactory
- The output factory.- Throws:
IOException
- If either file cannot be read.
-
-
Method Details
-
postConfig
Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfig
in interfacecom.oracle.labs.mlrg.olcut.config.Configurable
- Throws:
IOException
-
toString
-
getOutputFactory
Description copied from interface:DataSource
Returns the OutputFactory associated with this Output subclass.- Specified by:
getOutputFactory
in interfaceDataSource<T extends Output<T>>
- Returns:
- The output factory.
-
getProvenance
-
size
public int size()The number of examples loaded.- Returns:
- The number of examples.
-
getDataType
The type of the features that were loaded in.- Returns:
- The feature type.
-
iterator
-