validation - Why does my model have bad val_loss results with good loss results and prediction? -


i developed model in keras , provides bad val loss results. achieved results post training has 0.11 loss , 1.4 val_los

here input data

inputsa = np.array([[ 1,  1,  1, -1, -1, -1,-1, -1,-1, 1, 1, 1]], dtype=float).reshape((12, 1)) inputsb = np.array([[-1, -1, -1,  1,  1,  1,-1, -1,-1, 1, 1, 1]], dtype=float).reshape((12, 1)) inputsc = np.array([[-1,  1,  1, -1,  1,  1,-1,  1, 1,-1, 1, 1]], dtype=float).reshape((12, 1)) inputsd = np.array([[-1, -1,  1, -1, -1,  1,-1, -1, 1,-1,-1, 1]], dtype=float).reshape((12, 1))  input_arra = inputsa[0:8].reshape((8, 1)) input_arrb = inputsb[0:8].reshape((8, 1)) input_arrc = inputsc[0:8].reshape((8, 1)) input_arrd = inputsd[0:8].reshape((8, 1)) 

this target data

targets = np.array([[-1, -1, -1,                      1, -1, -1,                      1,  1, -1,                     -1,  1, -1,                     -1,  1,  1,                     -1,  1,  1,                      1, -1, -1,                     -1,  1, -1,                     -1, -1,  1,                      1, -1, -1,                     -1,  1, -1,                     -1, -1,  1]], dtype=float).reshape((12, 3))  target = targets[0:8].reshape((8, 3)) 

here test data evaluation

x_test = [inputsa[8:12].reshape((4, 1)),inputsa[8:12].reshape((4, 1)),inputsa[8:12].reshape((4, 1)),inputsa[8:12].reshape((4, 1))] y_test = [targets[8:12].reshape((4, 3)) 

]

here model

    inputa = input((1,))     inputd = input((1,))     inputb = input((1,))     inputc = input((1,))      inputadbc = concatenate()([inputa,inputd,inputb,inputc])     outn0 = dense(1, activation='tanh', weights=[np.array([[0.17],[0.17],[0],[0]]), np.array([0.11614])])(inputadbc)     outn1 = dense(1, activation='tanh', weights=[np.array([[0],[0],[0.17],[0.17]]), np.array([0.11614])])(inputadbc)      outn0n1 = concatenate()([outn0,outn1])     outc = dense(1, activation='tanh', weights = [np.array([[0.17],[0]]), np.array([0.0])])(outn0n1)     outd = dense(1, activation='tanh', weights = [np.array([[0],[0.17]]), np.array([0.0])])(outn0n1)     oute = dense(1, activation='tanh', weights = [np.array([[0],[0]]), np.array([0.0])])(outn0n1)      finalout = concatenate()([oute,outc,outd])     model = model(inputs=[inputa, inputd, inputb, inputc], outputs=finalout)      model.compile(loss='mean_absolute_error', optimizer='sgd')       model.fit([input_arra, input_arrd, input_arrb, input_arrc], target, epochs=3000, batch_size=1, verbose=2, validation_data=(x_test, y_test))     predict = model.predict([input_arra, input_arrd, input_arrb, input_arrc])  

my results epoch 5000/5000 0s - loss: 0.1144 - val_loss: 1.1629

model.predict shows 1 wrong value out of 24.. validation_data=(x_test, y_test) shows bad results , model.predict(x_test) shows 7 out of 12 wrong values if use test subset train subset..

please


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -