def __init__(self, learning_rate=0.1, train="keys_Training.sdo", cv="keys_CV.sdo", test="keys_Test.sdo"): print "Loading data sets" self.train_data = Network.parseSdo(SoundDataObject.loadSdo(train)) self.cv_data = Network.parseSdo(SoundDataObject.loadSdo(cv)) self.test_data = Network.parseSdo(SoundDataObject.loadSdo(test)) print "Done loading" self.build_mlp(learning_rate, len(self.train_data["Y"][0]))
def _getSdo(self, name, max_samples, labelCombos): sdo = SoundDataObject(name) for i in range(min(max_samples, len(labelCombos))): #use sound syns to get label and signal labels = [label for label in labelCombos[i]] syns = SoundSyns() for key in labels: syns.add_key(key) #get buckets decomp = SoundDecomposer(name) decomp.readSignal(SoundSyns.rate, syns.signal) #add buckets to sdo sdo.addDataSingle(Sample(decomp.freqBuckets, labels)) return sdo
from sound_data_object import SoundDataObject from sound_syns import SoundSyns sdo = SoundDataObject("test") sdo.save() newSdo = SoundDataObject.loadSdo("test")