Using SMAPE as a loss function for an LSTMLoss function for sparse taggingRNN for classification giving vastly different results (Keras)Classifier that optimizes performance on only a subset of the data?Understanding LSTM behaviour: Validation loss smaller than training loss throughout training for regression problemExpected behaviour of loss and accuracy when using data augmentationLSTM - divide gradients by number of timesteps IMMEDIATELY or in the end?Using deep learning to classify similar imagesTuning a sequence to sequence modelIs there any standard or normal range for the amount of LSTM loss function?

Identifying "long and narrow" polygons in with Postgis

Is there a distance limit for minecart tracks?

Extracting patterns from a text

Purpose of creating non root user

Proving a complicated language is not a CFL

Why is participating in the European Parliamentary elections used as a threat?

I'm just a whisper. Who am I?

How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?

Can I run 125khz RF circuit on a breadboard?

Can anyone precisely describe what it means (or feels like) to play exactly what your "inner ear" is hearing?

What happens if a creature's ETB would bounce Thalia, Heretic Cathar?

Asserting that Atheism and Theism are both faith based positions

Why does a 97 / 92 key piano exist by Bösendorfer?

Air travel with refrigerated insulin

Storage of electrolytic capacitors - how long?

El Dorado Word Puzzle II: Videogame Edition

Overlapping circles covering polygon

The Digit Triangles

Why the "ls" command is showing the permissions of files in a FAT32 partition?

Review your own paper in Mathematics

Why does the Persian emissary display a string of crowned skulls?

Should a narrator ever describe things based on a character's view instead of facts?

Limit max CPU usage SQL SERVER with WSRM

How to write Quadratic equation with negative coefficient



Using SMAPE as a loss function for an LSTM


Loss function for sparse taggingRNN for classification giving vastly different results (Keras)Classifier that optimizes performance on only a subset of the data?Understanding LSTM behaviour: Validation loss smaller than training loss throughout training for regression problemExpected behaviour of loss and accuracy when using data augmentationLSTM - divide gradients by number of timesteps IMMEDIATELY or in the end?Using deep learning to classify similar imagesTuning a sequence to sequence modelIs there any standard or normal range for the amount of LSTM loss function?













1












$begingroup$


I am currently working on a time series forecasting problem and am looking into using an LSTM.



My final accuracy metric that I use to determine whether or not the forecast is good or not is defined as follows:



$$textSMAPE-3 = fracsum^n_t=1sum^n_t=1left(y_t+haty_tright),$$



where $y_t$ is the actual value and $haty_t$ is the forecast value. So this formula will produce a score between $[0, 1]$. This score can then be subtracted from 1 to produce a percentage accuracy of the forecast over the specified forecast horizon



$$textAccuracy = 1-fracsum^n_t=1sum^n_t=1left(y_t+haty_tright).$$



I am using keras and have seen that I can specify a custom loss function and metric. As my forecast accuracy will be measured using sMAPE 3 (as defined above) it made sense to me to use this as my loss function. This is because my networks success will be measured by how well it scores using this. A score of 0 indicates 100% accuracy and a score of 1 indicates 0% accuracy.



So this raises two questions, can a metric such as smape be used as loss function at all, if so why / why not? Are the standard loss functions within keras considered better? Perhaps because they allow quicker convergence? Does my choice of using SMAPE3 as a loss function have an impact on what kind of optimiser I should use?



I ask because I haven't seen many people using loss functions other than RMSE, MSE and MAE and there must be a reason for this.










share|improve this question











$endgroup$
















    1












    $begingroup$


    I am currently working on a time series forecasting problem and am looking into using an LSTM.



    My final accuracy metric that I use to determine whether or not the forecast is good or not is defined as follows:



    $$textSMAPE-3 = fracsum^n_t=1sum^n_t=1left(y_t+haty_tright),$$



    where $y_t$ is the actual value and $haty_t$ is the forecast value. So this formula will produce a score between $[0, 1]$. This score can then be subtracted from 1 to produce a percentage accuracy of the forecast over the specified forecast horizon



    $$textAccuracy = 1-fracsum^n_t=1sum^n_t=1left(y_t+haty_tright).$$



    I am using keras and have seen that I can specify a custom loss function and metric. As my forecast accuracy will be measured using sMAPE 3 (as defined above) it made sense to me to use this as my loss function. This is because my networks success will be measured by how well it scores using this. A score of 0 indicates 100% accuracy and a score of 1 indicates 0% accuracy.



    So this raises two questions, can a metric such as smape be used as loss function at all, if so why / why not? Are the standard loss functions within keras considered better? Perhaps because they allow quicker convergence? Does my choice of using SMAPE3 as a loss function have an impact on what kind of optimiser I should use?



    I ask because I haven't seen many people using loss functions other than RMSE, MSE and MAE and there must be a reason for this.










    share|improve this question











    $endgroup$














      1












      1








      1


      1



      $begingroup$


      I am currently working on a time series forecasting problem and am looking into using an LSTM.



      My final accuracy metric that I use to determine whether or not the forecast is good or not is defined as follows:



      $$textSMAPE-3 = fracsum^n_t=1sum^n_t=1left(y_t+haty_tright),$$



      where $y_t$ is the actual value and $haty_t$ is the forecast value. So this formula will produce a score between $[0, 1]$. This score can then be subtracted from 1 to produce a percentage accuracy of the forecast over the specified forecast horizon



      $$textAccuracy = 1-fracsum^n_t=1sum^n_t=1left(y_t+haty_tright).$$



      I am using keras and have seen that I can specify a custom loss function and metric. As my forecast accuracy will be measured using sMAPE 3 (as defined above) it made sense to me to use this as my loss function. This is because my networks success will be measured by how well it scores using this. A score of 0 indicates 100% accuracy and a score of 1 indicates 0% accuracy.



      So this raises two questions, can a metric such as smape be used as loss function at all, if so why / why not? Are the standard loss functions within keras considered better? Perhaps because they allow quicker convergence? Does my choice of using SMAPE3 as a loss function have an impact on what kind of optimiser I should use?



      I ask because I haven't seen many people using loss functions other than RMSE, MSE and MAE and there must be a reason for this.










      share|improve this question











      $endgroup$




      I am currently working on a time series forecasting problem and am looking into using an LSTM.



      My final accuracy metric that I use to determine whether or not the forecast is good or not is defined as follows:



      $$textSMAPE-3 = fracsum^n_t=1sum^n_t=1left(y_t+haty_tright),$$



      where $y_t$ is the actual value and $haty_t$ is the forecast value. So this formula will produce a score between $[0, 1]$. This score can then be subtracted from 1 to produce a percentage accuracy of the forecast over the specified forecast horizon



      $$textAccuracy = 1-fracsum^n_t=1sum^n_t=1left(y_t+haty_tright).$$



      I am using keras and have seen that I can specify a custom loss function and metric. As my forecast accuracy will be measured using sMAPE 3 (as defined above) it made sense to me to use this as my loss function. This is because my networks success will be measured by how well it scores using this. A score of 0 indicates 100% accuracy and a score of 1 indicates 0% accuracy.



      So this raises two questions, can a metric such as smape be used as loss function at all, if so why / why not? Are the standard loss functions within keras considered better? Perhaps because they allow quicker convergence? Does my choice of using SMAPE3 as a loss function have an impact on what kind of optimiser I should use?



      I ask because I haven't seen many people using loss functions other than RMSE, MSE and MAE and there must be a reason for this.







      keras time-series lstm rnn loss-function






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 21:33







      Aesir

















      asked Nov 12 '18 at 11:38









      AesirAesir

      1498




      1498




















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          This is a great question. I too have been wondering about using sMAPE.
          Was reading a paper on "Modeling approaches for time series forecasting and anomaly detection" (S Du, 2017) . and it mentions using sMAPE as "This metric is more robust towards outliers and it has a unified scale across different time series with different scale." (ibid., 4)



          But most docs I see are using the standard RMSE, MSE, and MAE metrics.



          Would love to have this answered.






          share|improve this answer








          New contributor




          JohnnyDenim 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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f41093%2fusing-smape-as-a-loss-function-for-an-lstm%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$

            This is a great question. I too have been wondering about using sMAPE.
            Was reading a paper on "Modeling approaches for time series forecasting and anomaly detection" (S Du, 2017) . and it mentions using sMAPE as "This metric is more robust towards outliers and it has a unified scale across different time series with different scale." (ibid., 4)



            But most docs I see are using the standard RMSE, MSE, and MAE metrics.



            Would love to have this answered.






            share|improve this answer








            New contributor




            JohnnyDenim 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$

              This is a great question. I too have been wondering about using sMAPE.
              Was reading a paper on "Modeling approaches for time series forecasting and anomaly detection" (S Du, 2017) . and it mentions using sMAPE as "This metric is more robust towards outliers and it has a unified scale across different time series with different scale." (ibid., 4)



              But most docs I see are using the standard RMSE, MSE, and MAE metrics.



              Would love to have this answered.






              share|improve this answer








              New contributor




              JohnnyDenim 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$

                This is a great question. I too have been wondering about using sMAPE.
                Was reading a paper on "Modeling approaches for time series forecasting and anomaly detection" (S Du, 2017) . and it mentions using sMAPE as "This metric is more robust towards outliers and it has a unified scale across different time series with different scale." (ibid., 4)



                But most docs I see are using the standard RMSE, MSE, and MAE metrics.



                Would love to have this answered.






                share|improve this answer








                New contributor




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






                $endgroup$



                This is a great question. I too have been wondering about using sMAPE.
                Was reading a paper on "Modeling approaches for time series forecasting and anomaly detection" (S Du, 2017) . and it mentions using sMAPE as "This metric is more robust towards outliers and it has a unified scale across different time series with different scale." (ibid., 4)



                But most docs I see are using the standard RMSE, MSE, and MAE metrics.



                Would love to have this answered.







                share|improve this answer








                New contributor




                JohnnyDenim 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




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









                answered 1 hour ago









                JohnnyDenimJohnnyDenim

                1




                1




                New contributor




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





                New contributor





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






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



























                    draft saved

                    draft discarded
















































                    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%2f41093%2fusing-smape-as-a-loss-function-for-an-lstm%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







                    Popular posts from this blog

                    Ружовы пелікан Змест Знешні выгляд | Пашырэнне | Асаблівасці біялогіі | Літаратура | НавігацыяДагледжаная версіяправерана1 зменаДагледжаная версіяправерана1 змена/ 22697590 Сістэматыкана ВіківідахВыявына Вікісховішчы174693363011049382

                    ValueError: Error when checking input: expected conv2d_13_input to have shape (3, 150, 150) but got array with shape (150, 150, 3)2019 Community Moderator ElectionError when checking : expected dense_1_input to have shape (None, 5) but got array with shape (200, 1)Error 'Expected 2D array, got 1D array instead:'ValueError: Error when checking input: expected lstm_41_input to have 3 dimensions, but got array with shape (40000,100)ValueError: Error when checking target: expected dense_1 to have shape (7,) but got array with shape (1,)ValueError: Error when checking target: expected dense_2 to have shape (1,) but got array with shape (0,)Keras exception: ValueError: Error when checking input: expected conv2d_1_input to have shape (150, 150, 3) but got array with shape (256, 256, 3)Steps taking too long to completewhen checking input: expected dense_1_input to have shape (13328,) but got array with shape (317,)ValueError: Error when checking target: expected dense_3 to have shape (None, 1) but got array with shape (7715, 40000)Keras exception: Error when checking input: expected dense_input to have shape (2,) but got array with shape (1,)

                    Illegal assignment from SObject to ContactFetching String, Id from Map - Illegal Assignment Id to Field / ObjectError: Compile Error: Illegal assignment from String to BooleanError: List has no rows for assignment to SObjectError on Test Class - System.QueryException: List has no rows for assignment to SObjectRemote action problemDML requires SObject or SObject list type error“Illegal assignment from List to List”Test Class Fail: Batch Class: System.QueryException: List has no rows for assignment to SObjectMapping to a user'List has no rows for assignment to SObject' Mystery