Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ml4ht.data.data_source.DataIndex
generalizes the idea of a sample id by replacing an integer id with a dictionary of values to select data with.The simplest
DataIndex
is something like{"sample_id": 2}
, but you might also want to include something like the dates for your modalities:{"sample_id": 2, "ecg_date": 01-01-2000, "af_date": 02-01-2000}
.ml4ht.data.data_source.DataSource
generalizes the data-getting side ofml4h
TensorMap
s andDataDescription.get_raw_data
.A
DataSource
returns a dictionary of model inputs, and a dictionary of model outputs. For example,ECGHD5Source
might return{"ecg": np.array(...), "ecg_age": [12]}, {"AF": [0, 1]}
.In order to train using multiple
DataSource
s, you can useml4ht.data.data_source.TrainingDataset
, which integrates withpytorch
sDataLoader
for multiprocessing capabilities.If you want to skip errors, or change the indices each epoch, use
ml4ht.data.data_source.TrainingIterableDataset
.