At this ticket a new class SWat_Generator should be crated. The class must implement the interface keras.utils.Sequence
The class must implement three methods:
[x] __init__ which is a constructor:
it takes the parameters self, filename, labels , and batch_size. and set the last three locally
creates an instance Normaliser as local attribute with the parameters filename and batch_size + 100.
[x] __len__ which returns the number of batches:
it takes the parameter self
it gets the number of lines from the normaliser, subtract 100 from it (size of sample fix for now), and divide the result on the batch_size, then return the result
[x] __getitem__ it returns the batch of a given index
it takes the parameters self, and ind
returns two np.arrays with the size (batchSize, 100, 5) and (batchSize, 5)
calls the method readAndFilterBatchFromCsv at the normaliser with the parameter start = batchsize * ind and set the result at the variable output
The variable output now contains batchSize + 100 lines. We need to extract the samples with labels (number of samples is equal to batchSize). So the first sample will be as follow for example:
some code .....
for i in range (batchSize):
samples.append(output[i: i+100, :])
labels.append(output[i+100])
some code .....
At this ticket a new class
SWat_Generator
should be crated. The class must implement the interfacekeras.utils.Sequence
The class must implement three methods:
[x]
__init__
which is a constructor:self
,filename
,labels
, andbatch_size
. and set the last three locallyNormaliser
as local attribute with the parametersfilename
andbatch_size + 100
.[x]
__len__
which returns the number of batches:self
batch_size
, then return the result[x]
__getitem__
it returns the batch of a given indexself
, andind
np.array
s with the size (batchSize
, 100, 5) and (batchSize
, 5)readAndFilterBatchFromCsv
at the normaliser with the parameterstart = batchsize * ind
and set the result at the variableoutput
output
now containsbatchSize + 100
lines. We need to extract the samples with labels (number of samples is equal tobatchSize
). So the first sample will be as follow for example: