Keras: extreme spike in loss during trainingKeras difference beetween val_loss and loss during trainingThe...

Digits in an algebraic irrational number

Using only 1s, make 29 with the minimum number of digits

How can my powered armor quickly replace its ceramic plates?

Caruana vs Carlsen game 10 (WCC) why not 18...Nxb6?

Roman Numerals equation 1

Strange Sign on Lab Door

Word or phrase for showing great skill at something WITHOUT formal training in it

Traveling through the asteriod belt?

How to solve a large system of linear algebra?

Injecting creativity into a cookbook

How much mayhem could I cause as a sentient fish?

Am I a Rude Number?

How can I get my players to come to the game session after agreeing to a date?

Why are the books in the Game of Thrones citadel library shelved spine inwards?

How long is the D&D Starter Set campaign?

Is that a center tap tranformer just labelled differently?

My cat mixes up the floors in my building. How can I help him?

How to count the characters of jar files by wc

awk + sum all numbers

What is the purpose of easy combat scenarios that don't need resource expenditure?

Dilemma of explaining to interviewer that he is the reason for declining second interview

How to deal with an incendiary email that was recalled

Blindfold battle as a gladiatorial spectacle - what are the tactics and communication methods?

Cookies - Should the toggles be on?



Keras: extreme spike in loss during training


Keras difference beetween val_loss and loss during trainingThe validation loss < training loss and validation accuracy < training accuracySimple prediction with KerasHow to set input for proper fit with lstm?My Neural network in Tensorflow does a bad job in comparison to the same Neural network in KerasWhy is predicted rainfall by LSTM coming negative for some data points?Triplet loss training problemImages Score Regression only regresses to the average of the target valuesWhy doesn't loss go down during Neural Net training?keras plotting loss and MSE













0












$begingroup$


I am training an LSTM for time series forecasting and it has produced an extremly high loss value during one epoch:



Epoch 00043: saving model to /...
904/904 - 2s - loss: 0.7537 - mean_absolute_error: 0.5772 - val_loss: 1.4430
- val_mean_absolute_error: 0.7124

Epoch 00044: saving model to /...
904/904 - 2s - loss: 240372339275.7649 - mean_absolute_error: 56354.0078
- val_loss: 4.6229 - val_mean_absolute_error: 1.5681

Epoch 00045: saving model to /...
904/904 - 2s - loss: 1.3348 - mean_absolute_error: 0.7894 - val_loss: 2.2875
- val_mean_absolute_error: 1.1510


My model:



model = keras.Sequential()
model.add(keras.layers.LSTM(360, activation='relu', input_shape=(N_STEPS, n_features)))
model.add(keras.layers.Dropout(0.1))
model.add(keras.layers.Dense(1, activation='relu'))
model.compile(optimizer='adam', loss='mse', metrics=['mae'])


What is the cause of this?



Theoretically, it shouldn't be able to have such a high loss unless it outputs very high values for that epoch. Which is strange since the model's output makes sense during other epochs.










share|improve this question







New contributor




1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$

















    0












    $begingroup$


    I am training an LSTM for time series forecasting and it has produced an extremly high loss value during one epoch:



    Epoch 00043: saving model to /...
    904/904 - 2s - loss: 0.7537 - mean_absolute_error: 0.5772 - val_loss: 1.4430
    - val_mean_absolute_error: 0.7124

    Epoch 00044: saving model to /...
    904/904 - 2s - loss: 240372339275.7649 - mean_absolute_error: 56354.0078
    - val_loss: 4.6229 - val_mean_absolute_error: 1.5681

    Epoch 00045: saving model to /...
    904/904 - 2s - loss: 1.3348 - mean_absolute_error: 0.7894 - val_loss: 2.2875
    - val_mean_absolute_error: 1.1510


    My model:



    model = keras.Sequential()
    model.add(keras.layers.LSTM(360, activation='relu', input_shape=(N_STEPS, n_features)))
    model.add(keras.layers.Dropout(0.1))
    model.add(keras.layers.Dense(1, activation='relu'))
    model.compile(optimizer='adam', loss='mse', metrics=['mae'])


    What is the cause of this?



    Theoretically, it shouldn't be able to have such a high loss unless it outputs very high values for that epoch. Which is strange since the model's output makes sense during other epochs.










    share|improve this question







    New contributor




    1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$















      0












      0








      0





      $begingroup$


      I am training an LSTM for time series forecasting and it has produced an extremly high loss value during one epoch:



      Epoch 00043: saving model to /...
      904/904 - 2s - loss: 0.7537 - mean_absolute_error: 0.5772 - val_loss: 1.4430
      - val_mean_absolute_error: 0.7124

      Epoch 00044: saving model to /...
      904/904 - 2s - loss: 240372339275.7649 - mean_absolute_error: 56354.0078
      - val_loss: 4.6229 - val_mean_absolute_error: 1.5681

      Epoch 00045: saving model to /...
      904/904 - 2s - loss: 1.3348 - mean_absolute_error: 0.7894 - val_loss: 2.2875
      - val_mean_absolute_error: 1.1510


      My model:



      model = keras.Sequential()
      model.add(keras.layers.LSTM(360, activation='relu', input_shape=(N_STEPS, n_features)))
      model.add(keras.layers.Dropout(0.1))
      model.add(keras.layers.Dense(1, activation='relu'))
      model.compile(optimizer='adam', loss='mse', metrics=['mae'])


      What is the cause of this?



      Theoretically, it shouldn't be able to have such a high loss unless it outputs very high values for that epoch. Which is strange since the model's output makes sense during other epochs.










      share|improve this question







      New contributor




      1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      I am training an LSTM for time series forecasting and it has produced an extremly high loss value during one epoch:



      Epoch 00043: saving model to /...
      904/904 - 2s - loss: 0.7537 - mean_absolute_error: 0.5772 - val_loss: 1.4430
      - val_mean_absolute_error: 0.7124

      Epoch 00044: saving model to /...
      904/904 - 2s - loss: 240372339275.7649 - mean_absolute_error: 56354.0078
      - val_loss: 4.6229 - val_mean_absolute_error: 1.5681

      Epoch 00045: saving model to /...
      904/904 - 2s - loss: 1.3348 - mean_absolute_error: 0.7894 - val_loss: 2.2875
      - val_mean_absolute_error: 1.1510


      My model:



      model = keras.Sequential()
      model.add(keras.layers.LSTM(360, activation='relu', input_shape=(N_STEPS, n_features)))
      model.add(keras.layers.Dropout(0.1))
      model.add(keras.layers.Dense(1, activation='relu'))
      model.compile(optimizer='adam', loss='mse', metrics=['mae'])


      What is the cause of this?



      Theoretically, it shouldn't be able to have such a high loss unless it outputs very high values for that epoch. Which is strange since the model's output makes sense during other epochs.







      python keras regression lstm accuracy






      share|improve this question







      New contributor




      1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 18 hours ago









      1b151b15

      12




      12




      New contributor




      1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      1b15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          Sorry I couldn't comment as it requires 50 Reputation. On Epoch 44 there is a huge spike in the loss. It is entirely possible that the model may have come across new data and it may have learned a few tricks up its sleeve. Try to plot loss of train & validation vs epoch to see if it underfits or overfits.






          share|improve this answer








          New contributor




          Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "557"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });






            1b15 is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f46387%2fkeras-extreme-spike-in-loss-during-training%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            Sorry I couldn't comment as it requires 50 Reputation. On Epoch 44 there is a huge spike in the loss. It is entirely possible that the model may have come across new data and it may have learned a few tricks up its sleeve. Try to plot loss of train & validation vs epoch to see if it underfits or overfits.






            share|improve this answer








            New contributor




            Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






            $endgroup$


















              0












              $begingroup$

              Sorry I couldn't comment as it requires 50 Reputation. On Epoch 44 there is a huge spike in the loss. It is entirely possible that the model may have come across new data and it may have learned a few tricks up its sleeve. Try to plot loss of train & validation vs epoch to see if it underfits or overfits.






              share|improve this answer








              New contributor




              Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






              $endgroup$
















                0












                0








                0





                $begingroup$

                Sorry I couldn't comment as it requires 50 Reputation. On Epoch 44 there is a huge spike in the loss. It is entirely possible that the model may have come across new data and it may have learned a few tricks up its sleeve. Try to plot loss of train & validation vs epoch to see if it underfits or overfits.






                share|improve this answer








                New contributor




                Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                $endgroup$



                Sorry I couldn't comment as it requires 50 Reputation. On Epoch 44 there is a huge spike in the loss. It is entirely possible that the model may have come across new data and it may have learned a few tricks up its sleeve. Try to plot loss of train & validation vs epoch to see if it underfits or overfits.







                share|improve this answer








                New contributor




                Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 14 hours ago









                Hari_SheldonHari_Sheldon

                31




                31




                New contributor




                Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                Hari_Sheldon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






















                    1b15 is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    1b15 is a new contributor. Be nice, and check out our Code of Conduct.













                    1b15 is a new contributor. Be nice, and check out our Code of Conduct.












                    1b15 is a new contributor. Be nice, and check out our Code of Conduct.
















                    Thanks for contributing an answer to Data Science Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f46387%2fkeras-extreme-spike-in-loss-during-training%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown