From c1032d366aa18bf2e5f3942af5852c74dcb4a895 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Wed, 26 Apr 2017 11:59:01 +0200 Subject: [PATCH] verbosity added --- experiments.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/experiments.py b/experiments.py index adf76b1..989643e 100644 --- a/experiments.py +++ b/experiments.py @@ -17,6 +17,7 @@ from keras.layers import Dense, Dropout # , Activation # Testset ratio testset = 0.10 samplerate = 16000 +verbosity = 1 def get_datafiles(): files = glob.glob(os.path.join(os.getcwd(), 'textgrid', '*.TextGrid')) @@ -67,7 +68,8 @@ def run(typ, winlen, winstep, modelfun, modelname): labels = [] for tg, wavp in get_datafiles(): - (d, l) = features_from_wav(tg, wavp, winlen=winlen, winstep=winstep, typ=typ) + (d, l) = features_from_wav( + tg, wavp, winlen=winlen, winstep=winstep, typ=typ) datas.append(d) labels.append(l) @@ -88,16 +90,18 @@ def run(typ, winlen, winstep, modelfun, modelname): #Train model.fit(traindata, trainlabels, epochs=10, batch_size=32, shuffle=False, - verbose=0) + verbose=verbosity) #Test - loss, acc = model.evaluate(testdata, testlabels, batch_size=32, verbose=0) + loss, acc = model.evaluate(testdata, testlabels, batch_size=32, + verbose=verbosity) print('{}\t{}\t{}\t{}\t{}\n'.format( winlen, winstep, modelname, loss, acc)) def simplemodel(d): model = Sequential() - model.add(Dense(d.shape[1]*2, input_shape=(d.shape[1],), activation='relu')) + model.add( + Dense(d.shape[1]*2, input_shape=(d.shape[1],), activation='relu')) model.add(Dense(100, activation='relu')) model.add(Dense(1, activation='sigmoid')) model.compile(optimizer='rmsprop', @@ -107,7 +111,8 @@ def simplemodel(d): def bottlemodel(d): model = Sequential() - model.add(Dense(d.shape[1]*2, input_shape=(d.shape[1],), activation='relu')) + model.add( + Dense(d.shape[1]*2, input_shape=(d.shape[1],), activation='relu')) model.add(Dense(13, activation='relu')) model.add(Dense(1, activation='sigmoid')) model.compile(optimizer='rmsprop', -- 2.20.1