@@ -9,17 +9,25 @@
NoFart=extractFeature('./data/negative_sample_party_mono.wav')
NoFart2=extractFeature('./data/negative_sample_voice_mono.wav')

X=np.concatenate([Fart,NoFart,NoFart2],axis=1)
Fart.shape
NoFart.shape

#X=np.concatenate([Fart,NoFart,NoFart2],axis=1)
#Y=np.asarray([1 for i in range(Fart.shape[1])]+\
# [0 for i in range(NoFart.shape[1]+NoFart2.shape[1])]).astype('float32')


X=np.concatenate([Fart,NoFart],axis=1)
Y=np.asarray([1 for i in range(Fart.shape[1])]+\
[0 for i in range(NoFart.shape[1]+NoFart2.shape[1])]).astype('float32')
[0 for i in range(NoFart.shape[1])]).astype('float32')

VecNP=np.vstack([X,Y]).T
VecNP.shape
np.random.shuffle(VecNP)
X=VecNP[:,range(40)]
Y=VecNP[:,40]

TrainSize=150000
TrainSize=60000
ValidationSize=X.shape[0]-TrainSize


@@ -125,7 +133,28 @@

l2_model.evaluate(x=X_validation, y = Y_validation, batch_size=None, verbose=1)

Predict=list(chain.from_iterable(l2_model.predict(X_Test2).tolist()))
Predict=list(chain.from_iterable(l2_model.predict(X_validation,).tolist()))
type(Predict)
Real=Y_validation.tolist()
np.corrcoef(Predict,Real)

plt.clf() # clear figure
plt.plot(Predict,Real,'bo')

plt.show()



#new test
from keras.models import load_model

from itertools import chain

#model2=load_model('Fart_model.h5')

l2_model.evaluate(x=X_Test2, y = Y_Test2, batch_size=None, verbose=1)

Predict=list(chain.from_iterable(l2_model.predict(X_Test2,).tolist()))
type(Predict)
Real=Y_Test2.tolist()
np.corrcoef(Predict,Real)