The automatic data multiplication works like this:
for algorithm in multiplication_queue:
new_training_set = []
for recording in training_set:
samples = algorithm(recording)
for sample in samples:
new_training_set.append(sample)
training_set = new_training_set
return new_training_set
Warning
The create_ffile procedure replaces the current set of recordings by the set returned by the data multiplication steps.
Data multiplication algorithms.
Each algorithm works on the HandwrittenData class. They have to be applied like this:
>>> import data_multiplication as multiply
>>> a = HandwrittenData(...)
>>> multiplication_queue = [multiply.copy(10),
mulitply.rotate(-30, 30, 5)
]
>>> x = a.multiply(multiplication_queue)
Copy the data n times.
Add rotational variants of the recording.
Get features from a list of dictionaries
>>> l = [{'Multiply': [{'nr': 1}]}, {'Rotate': [{'minimum':-30}, {'maximum': 30}, {'step': 5}]}]
>>> get_data_multiplication_queue(l)
[Multiply (1 times), Rotate (-30.00, 30.00, 5.00)]