TRiba
TRiba

Reputation: 71

Getting worse result using keras 2 than keras 1

I ran the same code (with the same data) on CPU first using keras 1.2.0 and then keras 2.0.3 in both codes keras is with TensorFlow backend and also I used sklearn for model selection, plus pandas to read data.

I was surprised when I got the MSE(Mean squared error) of 42 using keras 2.0.3 and 21 using keras 1.2.0. Can someone pls explain to me why this is happening? Why I am getting more error using keras 2? Thanks

PS. This result is after editing the code to keras 2 standard. for example in Dense I change keras 1 code to keras 2 standard.

Upvotes: 4

Views: 438

Answers (3)

ascripter
ascripter

Reputation: 6233

Is really the MSE increased, or is it the loss? If you use regularizers, this may not be the same (even when using mean_squared_error as loss function), since the regularizer gives a penalty to the loss.

I think earlier versions of keras just gave you the MSE, now they show the loss. This could explain your observation.

Upvotes: 1

Fury
Fury

Reputation: 523

Keras 1 vs 2 has a lot of changes. Specifically the functions have many altered keyword arguments, your Keras 1 code is pretty worthless if your trying to run it after updating to Keras 2. Either downgrade back to version 1.2.0 or I would suggest going here and editing your code accordingly.

Upvotes: 0

dahoiv
dahoiv

Reputation: 85

Probably some default values that have changed from Keras 1.2. You should check the default values for you 1.2 code, and set the same value for your new code.

Upvotes: 0

Related Questions