Closed AnoopRKulkarni closed 4 years ago
There are many ways to do that.
Load batch_with_data.load(fmt='csv', src='/path/to/labels.csv', components='labels', index_col=0)
Load labels into a dataframe first with pandas.read_csv
and then batch_with_data.load(src=df_with_labels, components='labels')
Put labels directly - batch_with_data.labels = df_with_labels['labels'][batch_with_data.indices]
For this to work ensure that CSV is indexed with eds.indices
, i.e. the first column of the table contains the same elements as dataset indices.
thank you! got it working with (2) type syntax.
best regards, ~anoop
Hello all,
The flow of "dataset => batch => batch with data" is understood. "next_batch" can be called with an arbitrary batch_size.
My question is while loading the "target" component in "batch with data" how I can extract the same indices from the larger labeled data file?
e.g. consider the following eds = EcgDataset(path="*.hea") batch = eds.next_batch (batch_size = 8) batch_with_data = batch.load (fmt="wfdb", components = ["signal", "meta"]
Now, suppose I have totally 1000 .hea files and a csv file with 1000 outcome labels. How do I fetch exactly those 8 labels in "batch_with_data" that correspond to same indices as files in the batch from this larger 1000 labels array?
thanks
~anoop