CNTK C# LSTM Examples












1















Where can I find well-documented samples of LSTM models using CNTK C# (many-to-many, many-to-one, regression, classification)? Do they exist?



I have been trying to use CNTK in C# for about 4 months now, and it has been very hard to find good documentation in C#. So far, I have found these:




  1. CNTK C# sequence classifier (Github)
    https://github.com/Microsoft/CNTK/tree/master/Examples/TrainingCSharp/Common


Very hard to follow. Some of the nomenclature can be found at the (excellent) post: http://colah.github.io/posts/2015-08-Understanding-LSTMs/



But some parameters are confusing. What is LSTMDim, which becomes outputShape in function LSTMPComponentWithSelfStabilization? It seems that it is the length of the hidden state and not the output of the entire net. cellDim appears to be the dimension of the memory state. What exactly does CNTKLib.SequenceLast do?




  1. Sine wave predictor
    https://bhrnjica.net/2017/12/07/cntk-106-tutorial-time-series-prediction-with-lstm-using-c/


This example uses the LSTM Helper from the Github and is a port from the Python version. It uses cellDim = inDim = 5 in button1_Click event. I changed inDim to 15 and 10 to try some new configurations and got many errors in the process.










share|improve this question





























    1















    Where can I find well-documented samples of LSTM models using CNTK C# (many-to-many, many-to-one, regression, classification)? Do they exist?



    I have been trying to use CNTK in C# for about 4 months now, and it has been very hard to find good documentation in C#. So far, I have found these:




    1. CNTK C# sequence classifier (Github)
      https://github.com/Microsoft/CNTK/tree/master/Examples/TrainingCSharp/Common


    Very hard to follow. Some of the nomenclature can be found at the (excellent) post: http://colah.github.io/posts/2015-08-Understanding-LSTMs/



    But some parameters are confusing. What is LSTMDim, which becomes outputShape in function LSTMPComponentWithSelfStabilization? It seems that it is the length of the hidden state and not the output of the entire net. cellDim appears to be the dimension of the memory state. What exactly does CNTKLib.SequenceLast do?




    1. Sine wave predictor
      https://bhrnjica.net/2017/12/07/cntk-106-tutorial-time-series-prediction-with-lstm-using-c/


    This example uses the LSTM Helper from the Github and is a port from the Python version. It uses cellDim = inDim = 5 in button1_Click event. I changed inDim to 15 and 10 to try some new configurations and got many errors in the process.










    share|improve this question



























      1












      1








      1








      Where can I find well-documented samples of LSTM models using CNTK C# (many-to-many, many-to-one, regression, classification)? Do they exist?



      I have been trying to use CNTK in C# for about 4 months now, and it has been very hard to find good documentation in C#. So far, I have found these:




      1. CNTK C# sequence classifier (Github)
        https://github.com/Microsoft/CNTK/tree/master/Examples/TrainingCSharp/Common


      Very hard to follow. Some of the nomenclature can be found at the (excellent) post: http://colah.github.io/posts/2015-08-Understanding-LSTMs/



      But some parameters are confusing. What is LSTMDim, which becomes outputShape in function LSTMPComponentWithSelfStabilization? It seems that it is the length of the hidden state and not the output of the entire net. cellDim appears to be the dimension of the memory state. What exactly does CNTKLib.SequenceLast do?




      1. Sine wave predictor
        https://bhrnjica.net/2017/12/07/cntk-106-tutorial-time-series-prediction-with-lstm-using-c/


      This example uses the LSTM Helper from the Github and is a port from the Python version. It uses cellDim = inDim = 5 in button1_Click event. I changed inDim to 15 and 10 to try some new configurations and got many errors in the process.










      share|improve this question
















      Where can I find well-documented samples of LSTM models using CNTK C# (many-to-many, many-to-one, regression, classification)? Do they exist?



      I have been trying to use CNTK in C# for about 4 months now, and it has been very hard to find good documentation in C#. So far, I have found these:




      1. CNTK C# sequence classifier (Github)
        https://github.com/Microsoft/CNTK/tree/master/Examples/TrainingCSharp/Common


      Very hard to follow. Some of the nomenclature can be found at the (excellent) post: http://colah.github.io/posts/2015-08-Understanding-LSTMs/



      But some parameters are confusing. What is LSTMDim, which becomes outputShape in function LSTMPComponentWithSelfStabilization? It seems that it is the length of the hidden state and not the output of the entire net. cellDim appears to be the dimension of the memory state. What exactly does CNTKLib.SequenceLast do?




      1. Sine wave predictor
        https://bhrnjica.net/2017/12/07/cntk-106-tutorial-time-series-prediction-with-lstm-using-c/


      This example uses the LSTM Helper from the Github and is a port from the Python version. It uses cellDim = inDim = 5 in button1_Click event. I changed inDim to 15 and 10 to try some new configurations and got many errors in the process.







      c# lstm recurrent-neural-network cntk rnn






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 4 '18 at 3:11









      braaterAfrikaaner

      1,127517




      1,127517










      asked Feb 4 '18 at 0:22









      douglas125douglas125

      214




      214
























          1 Answer
          1






          active

          oldest

          votes


















          1














          CNTK C# support is rather poor compared to Python. There will be more and more examples, but they are merely an attempt to translate the same code from Python to C#. Python has built-in, clean and neat tools for creating deep learning stuff (for instance - cntk.layers module has practically anything you need). In C# you have to either write your own computation blocks(or mostly layers) via basic tools like CNTK.Parameter, CNTK.Function etc. or use their helpers. Thing is though, you may achieve different performance/convergence rates, because Python API is a bit more advanced.



          Back to the questions:





          • LSTMDim parameter is the output dimension of that very layer


          • cellDim is the dimension of the cell state


          You can see that LSTMDim and cellDim are set to be 25. In Python cellDim by default is None and output shape and cell shape may be different.





          • CNTKLib.SequenceLast returns the last element of the sequence

          • You must set int inDim = 10; in the beginning of the LSTMTimeSeries form as well, to get it started.


          There is upcoming 2.7 release, but having worked with CNTK for more than a year (both Python and C#) I have decided to stick to the Python API as it has an edge practically over anything in C#






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2fstackoverflow.com%2fquestions%2f48603497%2fcntk-c-sharp-lstm-examples%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














            CNTK C# support is rather poor compared to Python. There will be more and more examples, but they are merely an attempt to translate the same code from Python to C#. Python has built-in, clean and neat tools for creating deep learning stuff (for instance - cntk.layers module has practically anything you need). In C# you have to either write your own computation blocks(or mostly layers) via basic tools like CNTK.Parameter, CNTK.Function etc. or use their helpers. Thing is though, you may achieve different performance/convergence rates, because Python API is a bit more advanced.



            Back to the questions:





            • LSTMDim parameter is the output dimension of that very layer


            • cellDim is the dimension of the cell state


            You can see that LSTMDim and cellDim are set to be 25. In Python cellDim by default is None and output shape and cell shape may be different.





            • CNTKLib.SequenceLast returns the last element of the sequence

            • You must set int inDim = 10; in the beginning of the LSTMTimeSeries form as well, to get it started.


            There is upcoming 2.7 release, but having worked with CNTK for more than a year (both Python and C#) I have decided to stick to the Python API as it has an edge practically over anything in C#






            share|improve this answer




























              1














              CNTK C# support is rather poor compared to Python. There will be more and more examples, but they are merely an attempt to translate the same code from Python to C#. Python has built-in, clean and neat tools for creating deep learning stuff (for instance - cntk.layers module has practically anything you need). In C# you have to either write your own computation blocks(or mostly layers) via basic tools like CNTK.Parameter, CNTK.Function etc. or use their helpers. Thing is though, you may achieve different performance/convergence rates, because Python API is a bit more advanced.



              Back to the questions:





              • LSTMDim parameter is the output dimension of that very layer


              • cellDim is the dimension of the cell state


              You can see that LSTMDim and cellDim are set to be 25. In Python cellDim by default is None and output shape and cell shape may be different.





              • CNTKLib.SequenceLast returns the last element of the sequence

              • You must set int inDim = 10; in the beginning of the LSTMTimeSeries form as well, to get it started.


              There is upcoming 2.7 release, but having worked with CNTK for more than a year (both Python and C#) I have decided to stick to the Python API as it has an edge practically over anything in C#






              share|improve this answer


























                1












                1








                1







                CNTK C# support is rather poor compared to Python. There will be more and more examples, but they are merely an attempt to translate the same code from Python to C#. Python has built-in, clean and neat tools for creating deep learning stuff (for instance - cntk.layers module has practically anything you need). In C# you have to either write your own computation blocks(or mostly layers) via basic tools like CNTK.Parameter, CNTK.Function etc. or use their helpers. Thing is though, you may achieve different performance/convergence rates, because Python API is a bit more advanced.



                Back to the questions:





                • LSTMDim parameter is the output dimension of that very layer


                • cellDim is the dimension of the cell state


                You can see that LSTMDim and cellDim are set to be 25. In Python cellDim by default is None and output shape and cell shape may be different.





                • CNTKLib.SequenceLast returns the last element of the sequence

                • You must set int inDim = 10; in the beginning of the LSTMTimeSeries form as well, to get it started.


                There is upcoming 2.7 release, but having worked with CNTK for more than a year (both Python and C#) I have decided to stick to the Python API as it has an edge practically over anything in C#






                share|improve this answer













                CNTK C# support is rather poor compared to Python. There will be more and more examples, but they are merely an attempt to translate the same code from Python to C#. Python has built-in, clean and neat tools for creating deep learning stuff (for instance - cntk.layers module has practically anything you need). In C# you have to either write your own computation blocks(or mostly layers) via basic tools like CNTK.Parameter, CNTK.Function etc. or use their helpers. Thing is though, you may achieve different performance/convergence rates, because Python API is a bit more advanced.



                Back to the questions:





                • LSTMDim parameter is the output dimension of that very layer


                • cellDim is the dimension of the cell state


                You can see that LSTMDim and cellDim are set to be 25. In Python cellDim by default is None and output shape and cell shape may be different.





                • CNTKLib.SequenceLast returns the last element of the sequence

                • You must set int inDim = 10; in the beginning of the LSTMTimeSeries form as well, to get it started.


                There is upcoming 2.7 release, but having worked with CNTK for more than a year (both Python and C#) I have decided to stick to the Python API as it has an edge practically over anything in C#







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 '18 at 12:59









                papadoble151papadoble151

                438413




                438413






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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.


                    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%2fstackoverflow.com%2fquestions%2f48603497%2fcntk-c-sharp-lstm-examples%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

                    Create new schema in PostgreSQL using DBeaver

                    Deepest pit of an array with Javascript: test on Codility

                    Costa Masnaga