| [labels, images] = read_mnist8m_libsvm_parallel('mnist8m',8.1e6); | |
| % Define chunk size (e.g., 100,000 rows at a time) | |
| chunk_size = [1e5, 784]; | |
| % % Create an HDF5 dataset label with chunking | |
| % h5create('MNIST8M_labels.h5', '/MNIST8M', [size(images, 1), ... | |
| % 'Datatype', 'uint8', 'ChunkSize', chunk_size); | |
| % | |
| % % Write data to the file | |
| % h5write('MNIST8M_labels.h5', '/MNIST8M', data); | |
| % Create an HDF5 dataset with chunking | |
| h5create('MNIST8M_data.h5', '/MNIST8M', size(images), ... | |
| 'Datatype', 'uint8', 'ChunkSize', chunk_size); | |
| % Write data to the file | |
| h5write('MNIST8M_data.h5', '/MNIST8M', images); | |
| % Load data partially, chunk by chunk | |
| subset = h5read('MNIST8M_data.h5', '/MNIST8M', [1, 1], chunk_size); |