Skip to content

Commit

Permalink
HDF5Matrix documentation (keras-team#3931)
Browse files Browse the repository at this point in the history
  • Loading branch information
mezzode authored and fchollet committed Oct 1, 2016
1 parent 04df170 commit 6ee5d61
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
from keras import constraints
from keras import activations
from keras import regularizers
from keras.utils import io_utils


EXCLUDE = {
Expand Down Expand Up @@ -237,6 +238,12 @@
'page': 'backend.md',
'all_module_functions': [backend],
},
{
'page': 'io_utils.md',
'classes': [
io_utils.HDF5Matrix
],
},
]

ROOT = 'http://keras.io/'
Expand Down
2 changes: 2 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ pages:
- Constraints: constraints.md
- Visualization: visualization.md
- Scikit-learn API: scikit-learn-api.md
- Utils:
- I/O Utils: io_utils.md



Expand Down
24 changes: 24 additions & 0 deletions keras/utils/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@


class HDF5Matrix():
'''Representation of HDF5 dataset which can be used instead of a
Numpy array.
# Example
```python
X_data = HDF5Matrix('input/file.hdf5', 'data')
model.predict(X_data)
```
Providing start and end allows use of a slice of the dataset.
Optionally, a normalizer function (or lambda) can be given. This will
be called on every slice of data retrieved.
# Arguments
datapath: string, path to a HDF5 file
dataset: string, name of the HDF5 dataset in the file specified
in datapath
start: int, start of desired slice of the specified dataset
end: int, end of desired slice of the specified dataset
normalizer: function to be called on data when retrieved
'''
refs = defaultdict(int)

def __init__(self, datapath, dataset, start, end, normalizer=None):
Expand Down

0 comments on commit 6ee5d61

Please sign in to comment.