Non linear Regression: Why isn't the model learning?

前端 未结 1 838
生来不讨喜
生来不讨喜 2021-01-14 00:45

I just started learning keras. I am trying to train a non-linear regression model in keras but model doesn\'t seem to learn much.



        
1条回答
  •  野的像风
    2021-01-14 00:55

    Your learning rate is way too high.

    Also, irrelevant to your issue, but you should not ask for metrics=['accuracy'], as this is a regression setting and accuracy is meaningless.

    So, with these changes:

    sgd = SGD(lr=0.001);
    model.compile(loss='mse', optimizer=sgd)
    
    plt.legend([ 'Predicted Y' ,'Actual Y']) # typo in legend :)
    

    here are some outputs (results will be different among runs, due to the random element of your y):

    0 讨论(0)
提交回复
热议问题