how to apply MC dropout to an LSTM network keras2019 Community Moderator ElectionKeras LSTM: use weights from Keras model to replicate predictions using numpyDropout implies stochastic descent?How to set input for proper fit with lstm?What does SpatialDropout1D() do to output of Embedding() in Keras?Dropout in Deep Neural NetworksWhat is the correct format of the test input for LSTM neural network?Monte Carlo dropoutHow to design a many-to-many LSTM?Split timeline for training LSTM network

Blender 2.8 I can't see vertices, edges or faces in edit mode

90's TV series where a boy goes to another dimension through portal near power lines

Fully-Firstable Anagram Sets

Ambiguity in the definition of entropy

GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?

Is there a way of "bevelling" a single vertex?

How could indestructible materials be used in power generation?

Is it possible to download Internet Explorer on my Mac running OS X El Capitan?

Can a rocket refuel on Mars from water?

Does a druid starting with a bow start with no arrows?

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

Why would the Red Woman birth a shadow if she worshipped the Lord of the Light?

How much of data wrangling is a data scientist's job?

Asymptotics of orbits on graphs

A reference to a well-known characterization of scattered compact spaces

Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?

What's the point of deactivating Num Lock on login screens?

What about the virus in 12 Monkeys?

numexpr behavior in math mode and/or TikZ

How seriously should I take size and weight limits of hand luggage?

Neighboring nodes in the network

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Assassin's bullet with mercury

Contemplating leaving job of two years, but a long travel is in the works. Is it professional for me to resign?



how to apply MC dropout to an LSTM network keras



2019 Community Moderator ElectionKeras LSTM: use weights from Keras model to replicate predictions using numpyDropout implies stochastic descent?How to set input for proper fit with lstm?What does SpatialDropout1D() do to output of Embedding() in Keras?Dropout in Deep Neural NetworksWhat is the correct format of the test input for LSTM neural network?Monte Carlo dropoutHow to design a many-to-many LSTM?Split timeline for training LSTM network










1












$begingroup$


I have a simple LSTM network developped using keras:



model = Sequential()
model.add(LSTM(rnn_size,input_shape=(2,w),dropout = 0.25 , recurrent_dropout=0.25))
model.add(Dense(2))


I would like to apply the MC dropout method. How can I enable dropout in the test phase in order to compute the uncertainty?



Thanks.










share|improve this question











$endgroup$







  • 1




    $begingroup$
    Welcome! What do you mean by MC? Please consider dropout is used while training not testing.
    $endgroup$
    – Media
    Mar 26 at 14:29










  • $begingroup$
    i mean montecarlo dropout ,which is a bayesien neural network approach for computing the uncertainty in deep learning
    $endgroup$
    – khaoula
    Mar 26 at 14:38















1












$begingroup$


I have a simple LSTM network developped using keras:



model = Sequential()
model.add(LSTM(rnn_size,input_shape=(2,w),dropout = 0.25 , recurrent_dropout=0.25))
model.add(Dense(2))


I would like to apply the MC dropout method. How can I enable dropout in the test phase in order to compute the uncertainty?



Thanks.










share|improve this question











$endgroup$







  • 1




    $begingroup$
    Welcome! What do you mean by MC? Please consider dropout is used while training not testing.
    $endgroup$
    – Media
    Mar 26 at 14:29










  • $begingroup$
    i mean montecarlo dropout ,which is a bayesien neural network approach for computing the uncertainty in deep learning
    $endgroup$
    – khaoula
    Mar 26 at 14:38













1












1








1





$begingroup$


I have a simple LSTM network developped using keras:



model = Sequential()
model.add(LSTM(rnn_size,input_shape=(2,w),dropout = 0.25 , recurrent_dropout=0.25))
model.add(Dense(2))


I would like to apply the MC dropout method. How can I enable dropout in the test phase in order to compute the uncertainty?



Thanks.










share|improve this question











$endgroup$




I have a simple LSTM network developped using keras:



model = Sequential()
model.add(LSTM(rnn_size,input_shape=(2,w),dropout = 0.25 , recurrent_dropout=0.25))
model.add(Dense(2))


I would like to apply the MC dropout method. How can I enable dropout in the test phase in order to compute the uncertainty?



Thanks.







deep-learning lstm recurrent-neural-net dropout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 4:10









Ethan

671425




671425










asked Mar 26 at 14:24









khaoulakhaoula

61




61







  • 1




    $begingroup$
    Welcome! What do you mean by MC? Please consider dropout is used while training not testing.
    $endgroup$
    – Media
    Mar 26 at 14:29










  • $begingroup$
    i mean montecarlo dropout ,which is a bayesien neural network approach for computing the uncertainty in deep learning
    $endgroup$
    – khaoula
    Mar 26 at 14:38












  • 1




    $begingroup$
    Welcome! What do you mean by MC? Please consider dropout is used while training not testing.
    $endgroup$
    – Media
    Mar 26 at 14:29










  • $begingroup$
    i mean montecarlo dropout ,which is a bayesien neural network approach for computing the uncertainty in deep learning
    $endgroup$
    – khaoula
    Mar 26 at 14:38







1




1




$begingroup$
Welcome! What do you mean by MC? Please consider dropout is used while training not testing.
$endgroup$
– Media
Mar 26 at 14:29




$begingroup$
Welcome! What do you mean by MC? Please consider dropout is used while training not testing.
$endgroup$
– Media
Mar 26 at 14:29












$begingroup$
i mean montecarlo dropout ,which is a bayesien neural network approach for computing the uncertainty in deep learning
$endgroup$
– khaoula
Mar 26 at 14:38




$begingroup$
i mean montecarlo dropout ,which is a bayesien neural network approach for computing the uncertainty in deep learning
$endgroup$
– khaoula
Mar 26 at 14:38










1 Answer
1






active

oldest

votes


















1












$begingroup$

Well, in order to enable dropout during test phase you can do something like this:



keras.layers.Dropout(0.5)(x, training=True)


Then you'll probably want to run it multiple times. If you don't care about the inference time just run forward pass multiple times and at the end calculate mean and variance of your output.






share|improve this answer











$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%2f48030%2fhow-to-apply-mc-dropout-to-an-lstm-network-keras%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









    1












    $begingroup$

    Well, in order to enable dropout during test phase you can do something like this:



    keras.layers.Dropout(0.5)(x, training=True)


    Then you'll probably want to run it multiple times. If you don't care about the inference time just run forward pass multiple times and at the end calculate mean and variance of your output.






    share|improve this answer











    $endgroup$

















      1












      $begingroup$

      Well, in order to enable dropout during test phase you can do something like this:



      keras.layers.Dropout(0.5)(x, training=True)


      Then you'll probably want to run it multiple times. If you don't care about the inference time just run forward pass multiple times and at the end calculate mean and variance of your output.






      share|improve this answer











      $endgroup$















        1












        1








        1





        $begingroup$

        Well, in order to enable dropout during test phase you can do something like this:



        keras.layers.Dropout(0.5)(x, training=True)


        Then you'll probably want to run it multiple times. If you don't care about the inference time just run forward pass multiple times and at the end calculate mean and variance of your output.






        share|improve this answer











        $endgroup$



        Well, in order to enable dropout during test phase you can do something like this:



        keras.layers.Dropout(0.5)(x, training=True)


        Then you'll probably want to run it multiple times. If you don't care about the inference time just run forward pass multiple times and at the end calculate mean and variance of your output.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 27 at 10:07

























        answered Mar 27 at 10:01









        Marat SeroglazovMarat Seroglazov

        112




        112



























            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%2f48030%2fhow-to-apply-mc-dropout-to-an-lstm-network-keras%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

            Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

            Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

            Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High