Can a neural network compute $y = x^2$? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) 2019 Moderator Election Q&A - Questionnaire 2019 Community Moderator Election ResultsDebugging Neural Network for (Natural Language) TaggingIs ML a good solution for identifying what the user wants to do from a sentence?Which functions neural net can't approximateQ Learning Neural network for tic tac toe Input implementation problemError in Neural NetworkWhat database should I use?Reinforcement learning - How to deal with varying number of actions which do number approximationMultiple-input multiple-output CNN with custom loss functionWhy are neuron activations stored as a column vector?Learning a highly non-linear function with a small data set

Normal Operator || T^2|| = ||T||^2

Raising a bilingual kid. When should we introduce the majority language?

Is my guitar’s action too high?

How to create a command for the "strange m" symbol in latex?

Why doesn't the university give past final exams' answers?

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

Should man-made satellites feature an intelligent inverted "cow catcher"?

Proving inequality for positive definite matrix

Does the Pact of the Blade warlock feature allow me to customize the properties of the pact weapon I create?

Why aren't road bike wheels tiny?

Can I ask an author to send me his ebook?

Who can become a wight?

Who's this lady in the war room?

Trying to enter the Fox's den

Has a Nobel Peace laureate ever been accused of war crimes?

What is the ongoing value of the Kanban board to the developers as opposed to management

How to leave only the following strings?

Weaponising the Grasp-at-a-Distance spell

Why did Israel vote against lifting the American embargo on Cuba?

What kind of equipment or other technology is necessary to photograph sprites (atmospheric phenomenon)

Is Bran literally the world's memory?

Providing direct feedback to a product salesperson

Help Recreating a Table

Why do C and C++ allow the expression (int) + 4*5?



Can a neural network compute $y = x^2$?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Moderator Election Q&A - Questionnaire
2019 Community Moderator Election ResultsDebugging Neural Network for (Natural Language) TaggingIs ML a good solution for identifying what the user wants to do from a sentence?Which functions neural net can't approximateQ Learning Neural network for tic tac toe Input implementation problemError in Neural NetworkWhat database should I use?Reinforcement learning - How to deal with varying number of actions which do number approximationMultiple-input multiple-output CNN with custom loss functionWhy are neuron activations stored as a column vector?Learning a highly non-linear function with a small data set










8












$begingroup$


In spirit of the famous Tensorflow Fizz Buzz joke and XOr problem I started to think, if it's possible to design a neural network that implements $y = x^2$ function?



Given some representation of a number (e.g. as a vector in binary form, so that number 5 is represented as [1,0,1,0,0,0,0,...]), the neural network should learn to return its square - 25 in this case.



If I could implement $y=x^2$, I could probably implement $y=x^3$ and generally any polynomial of x, and then with Taylor series I could approximate $y=sin(x)$, which would solve the Fizz Buzz problem - a neural network that can find remainder of the division.



Clearly, just the linear part of NNs won't be able to perform this task, so if we could do the multiplication, it would be happening thanks to activation function.



Can you suggest any ideas or reading on subject?










share|improve this question











$endgroup$
















    8












    $begingroup$


    In spirit of the famous Tensorflow Fizz Buzz joke and XOr problem I started to think, if it's possible to design a neural network that implements $y = x^2$ function?



    Given some representation of a number (e.g. as a vector in binary form, so that number 5 is represented as [1,0,1,0,0,0,0,...]), the neural network should learn to return its square - 25 in this case.



    If I could implement $y=x^2$, I could probably implement $y=x^3$ and generally any polynomial of x, and then with Taylor series I could approximate $y=sin(x)$, which would solve the Fizz Buzz problem - a neural network that can find remainder of the division.



    Clearly, just the linear part of NNs won't be able to perform this task, so if we could do the multiplication, it would be happening thanks to activation function.



    Can you suggest any ideas or reading on subject?










    share|improve this question











    $endgroup$














      8












      8








      8


      4



      $begingroup$


      In spirit of the famous Tensorflow Fizz Buzz joke and XOr problem I started to think, if it's possible to design a neural network that implements $y = x^2$ function?



      Given some representation of a number (e.g. as a vector in binary form, so that number 5 is represented as [1,0,1,0,0,0,0,...]), the neural network should learn to return its square - 25 in this case.



      If I could implement $y=x^2$, I could probably implement $y=x^3$ and generally any polynomial of x, and then with Taylor series I could approximate $y=sin(x)$, which would solve the Fizz Buzz problem - a neural network that can find remainder of the division.



      Clearly, just the linear part of NNs won't be able to perform this task, so if we could do the multiplication, it would be happening thanks to activation function.



      Can you suggest any ideas or reading on subject?










      share|improve this question











      $endgroup$




      In spirit of the famous Tensorflow Fizz Buzz joke and XOr problem I started to think, if it's possible to design a neural network that implements $y = x^2$ function?



      Given some representation of a number (e.g. as a vector in binary form, so that number 5 is represented as [1,0,1,0,0,0,0,...]), the neural network should learn to return its square - 25 in this case.



      If I could implement $y=x^2$, I could probably implement $y=x^3$ and generally any polynomial of x, and then with Taylor series I could approximate $y=sin(x)$, which would solve the Fizz Buzz problem - a neural network that can find remainder of the division.



      Clearly, just the linear part of NNs won't be able to perform this task, so if we could do the multiplication, it would be happening thanks to activation function.



      Can you suggest any ideas or reading on subject?







      machine-learning neural-network






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 17:25







      Boris Burkov

















      asked Mar 22 at 13:02









      Boris BurkovBoris Burkov

      1435




      1435




















          2 Answers
          2






          active

          oldest

          votes


















          7












          $begingroup$

          Neural networks are also called as the universal function approximation which is based in the universal function approximation theorem. It states that :




          In the mathematical theory of artificial neural networks,
          the universal approximation theorem states that a feed-forward network
          with a single hidden layer containing a finite number of neurons can
          approximate continuous functions on compact subsets of Rn, under mild
          assumptions on the activation function




          Meaning a ANN with a non linear activation function could map the function which relates the input with the output. The function y = x^2 could be easily approximated using regression ANN.



          You can find an excellent lesson here with a notebook example.



          Also, because of such ability ANN could map complex relationships for example between an image and its labels.






          share|improve this answer









          $endgroup$








          • 2




            $begingroup$
            Thank you very much, this is exactly what I was asking for!
            $endgroup$
            – Boris Burkov
            Mar 22 at 13:23






          • 2




            $begingroup$
            Although true, it a very bad idea to learn that. I fail to see where any generalization power would arise from. NN shine when there's something to generalize. Like CNN for vision that capture patterns, or RNN that can capture trends.
            $endgroup$
            – Jeffrey
            Mar 22 at 15:21



















          9












          $begingroup$

          I think the answer of @ShubhamPanchal is a little bit misleading. Yes, it is true that by Cybenko's universal approximation theorem we can approximate $f(x)=x^2$ with a single hidden layer containing a finite number of neurons can approximate continuous functions on compact subsets of $mathbbR^n$, under mild assumptions on the activation function.




          But the main problem is that the theorem has a very important
          limitation
          . The function needs to be defined on compact subsets of
          $mathbbR^n$
          (compact subset = bounded + closed subset). But why
          is this problematic?
          . When training the function approximator you
          will always have a finite data set. Hence, you will approximate the
          function inside a compact subset of $mathbbR^n$. But we can always
          find a point $x$ for which the approximation will probably fail. That
          being said. If you only want to approximate $f(x)=x^2$ on a compact
          subset of $mathbbR$ then we can answer your question with yes.
          But if you want to approximate $f(x)=x^2$ for all $xin mathbbR$
          then the answer is no (I exclude the trivial case in which you use
          a quadratic activation function).




          Side remark on Taylor approximation: You always have to keep in mind that a Taylor approximation is only a local approximation. If you only want to approximate a function in a predefined region then you should be able to use Taylor series. But approximating $sin(x)$ by the Taylor series evaluated at $x=0$ will give you horrible results for $xto 10000$ if you don't use enough terms in your Taylor expansion.






          share|improve this answer











          $endgroup$








          • 2




            $begingroup$
            Nice catch! "compact set".
            $endgroup$
            – Esmailian
            Mar 22 at 17:14






          • 1




            $begingroup$
            Many thanks, mate! Eye-opener!
            $endgroup$
            – Boris Burkov
            Mar 22 at 17:23











          Your Answer








          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%2f47787%2fcan-a-neural-network-compute-y-x2%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          7












          $begingroup$

          Neural networks are also called as the universal function approximation which is based in the universal function approximation theorem. It states that :




          In the mathematical theory of artificial neural networks,
          the universal approximation theorem states that a feed-forward network
          with a single hidden layer containing a finite number of neurons can
          approximate continuous functions on compact subsets of Rn, under mild
          assumptions on the activation function




          Meaning a ANN with a non linear activation function could map the function which relates the input with the output. The function y = x^2 could be easily approximated using regression ANN.



          You can find an excellent lesson here with a notebook example.



          Also, because of such ability ANN could map complex relationships for example between an image and its labels.






          share|improve this answer









          $endgroup$








          • 2




            $begingroup$
            Thank you very much, this is exactly what I was asking for!
            $endgroup$
            – Boris Burkov
            Mar 22 at 13:23






          • 2




            $begingroup$
            Although true, it a very bad idea to learn that. I fail to see where any generalization power would arise from. NN shine when there's something to generalize. Like CNN for vision that capture patterns, or RNN that can capture trends.
            $endgroup$
            – Jeffrey
            Mar 22 at 15:21
















          7












          $begingroup$

          Neural networks are also called as the universal function approximation which is based in the universal function approximation theorem. It states that :




          In the mathematical theory of artificial neural networks,
          the universal approximation theorem states that a feed-forward network
          with a single hidden layer containing a finite number of neurons can
          approximate continuous functions on compact subsets of Rn, under mild
          assumptions on the activation function




          Meaning a ANN with a non linear activation function could map the function which relates the input with the output. The function y = x^2 could be easily approximated using regression ANN.



          You can find an excellent lesson here with a notebook example.



          Also, because of such ability ANN could map complex relationships for example between an image and its labels.






          share|improve this answer









          $endgroup$








          • 2




            $begingroup$
            Thank you very much, this is exactly what I was asking for!
            $endgroup$
            – Boris Burkov
            Mar 22 at 13:23






          • 2




            $begingroup$
            Although true, it a very bad idea to learn that. I fail to see where any generalization power would arise from. NN shine when there's something to generalize. Like CNN for vision that capture patterns, or RNN that can capture trends.
            $endgroup$
            – Jeffrey
            Mar 22 at 15:21














          7












          7








          7





          $begingroup$

          Neural networks are also called as the universal function approximation which is based in the universal function approximation theorem. It states that :




          In the mathematical theory of artificial neural networks,
          the universal approximation theorem states that a feed-forward network
          with a single hidden layer containing a finite number of neurons can
          approximate continuous functions on compact subsets of Rn, under mild
          assumptions on the activation function




          Meaning a ANN with a non linear activation function could map the function which relates the input with the output. The function y = x^2 could be easily approximated using regression ANN.



          You can find an excellent lesson here with a notebook example.



          Also, because of such ability ANN could map complex relationships for example between an image and its labels.






          share|improve this answer









          $endgroup$



          Neural networks are also called as the universal function approximation which is based in the universal function approximation theorem. It states that :




          In the mathematical theory of artificial neural networks,
          the universal approximation theorem states that a feed-forward network
          with a single hidden layer containing a finite number of neurons can
          approximate continuous functions on compact subsets of Rn, under mild
          assumptions on the activation function




          Meaning a ANN with a non linear activation function could map the function which relates the input with the output. The function y = x^2 could be easily approximated using regression ANN.



          You can find an excellent lesson here with a notebook example.



          Also, because of such ability ANN could map complex relationships for example between an image and its labels.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 22 at 13:20









          Shubham PanchalShubham Panchal

          403110




          403110







          • 2




            $begingroup$
            Thank you very much, this is exactly what I was asking for!
            $endgroup$
            – Boris Burkov
            Mar 22 at 13:23






          • 2




            $begingroup$
            Although true, it a very bad idea to learn that. I fail to see where any generalization power would arise from. NN shine when there's something to generalize. Like CNN for vision that capture patterns, or RNN that can capture trends.
            $endgroup$
            – Jeffrey
            Mar 22 at 15:21













          • 2




            $begingroup$
            Thank you very much, this is exactly what I was asking for!
            $endgroup$
            – Boris Burkov
            Mar 22 at 13:23






          • 2




            $begingroup$
            Although true, it a very bad idea to learn that. I fail to see where any generalization power would arise from. NN shine when there's something to generalize. Like CNN for vision that capture patterns, or RNN that can capture trends.
            $endgroup$
            – Jeffrey
            Mar 22 at 15:21








          2




          2




          $begingroup$
          Thank you very much, this is exactly what I was asking for!
          $endgroup$
          – Boris Burkov
          Mar 22 at 13:23




          $begingroup$
          Thank you very much, this is exactly what I was asking for!
          $endgroup$
          – Boris Burkov
          Mar 22 at 13:23




          2




          2




          $begingroup$
          Although true, it a very bad idea to learn that. I fail to see where any generalization power would arise from. NN shine when there's something to generalize. Like CNN for vision that capture patterns, or RNN that can capture trends.
          $endgroup$
          – Jeffrey
          Mar 22 at 15:21





          $begingroup$
          Although true, it a very bad idea to learn that. I fail to see where any generalization power would arise from. NN shine when there's something to generalize. Like CNN for vision that capture patterns, or RNN that can capture trends.
          $endgroup$
          – Jeffrey
          Mar 22 at 15:21












          9












          $begingroup$

          I think the answer of @ShubhamPanchal is a little bit misleading. Yes, it is true that by Cybenko's universal approximation theorem we can approximate $f(x)=x^2$ with a single hidden layer containing a finite number of neurons can approximate continuous functions on compact subsets of $mathbbR^n$, under mild assumptions on the activation function.




          But the main problem is that the theorem has a very important
          limitation
          . The function needs to be defined on compact subsets of
          $mathbbR^n$
          (compact subset = bounded + closed subset). But why
          is this problematic?
          . When training the function approximator you
          will always have a finite data set. Hence, you will approximate the
          function inside a compact subset of $mathbbR^n$. But we can always
          find a point $x$ for which the approximation will probably fail. That
          being said. If you only want to approximate $f(x)=x^2$ on a compact
          subset of $mathbbR$ then we can answer your question with yes.
          But if you want to approximate $f(x)=x^2$ for all $xin mathbbR$
          then the answer is no (I exclude the trivial case in which you use
          a quadratic activation function).




          Side remark on Taylor approximation: You always have to keep in mind that a Taylor approximation is only a local approximation. If you only want to approximate a function in a predefined region then you should be able to use Taylor series. But approximating $sin(x)$ by the Taylor series evaluated at $x=0$ will give you horrible results for $xto 10000$ if you don't use enough terms in your Taylor expansion.






          share|improve this answer











          $endgroup$








          • 2




            $begingroup$
            Nice catch! "compact set".
            $endgroup$
            – Esmailian
            Mar 22 at 17:14






          • 1




            $begingroup$
            Many thanks, mate! Eye-opener!
            $endgroup$
            – Boris Burkov
            Mar 22 at 17:23















          9












          $begingroup$

          I think the answer of @ShubhamPanchal is a little bit misleading. Yes, it is true that by Cybenko's universal approximation theorem we can approximate $f(x)=x^2$ with a single hidden layer containing a finite number of neurons can approximate continuous functions on compact subsets of $mathbbR^n$, under mild assumptions on the activation function.




          But the main problem is that the theorem has a very important
          limitation
          . The function needs to be defined on compact subsets of
          $mathbbR^n$
          (compact subset = bounded + closed subset). But why
          is this problematic?
          . When training the function approximator you
          will always have a finite data set. Hence, you will approximate the
          function inside a compact subset of $mathbbR^n$. But we can always
          find a point $x$ for which the approximation will probably fail. That
          being said. If you only want to approximate $f(x)=x^2$ on a compact
          subset of $mathbbR$ then we can answer your question with yes.
          But if you want to approximate $f(x)=x^2$ for all $xin mathbbR$
          then the answer is no (I exclude the trivial case in which you use
          a quadratic activation function).




          Side remark on Taylor approximation: You always have to keep in mind that a Taylor approximation is only a local approximation. If you only want to approximate a function in a predefined region then you should be able to use Taylor series. But approximating $sin(x)$ by the Taylor series evaluated at $x=0$ will give you horrible results for $xto 10000$ if you don't use enough terms in your Taylor expansion.






          share|improve this answer











          $endgroup$








          • 2




            $begingroup$
            Nice catch! "compact set".
            $endgroup$
            – Esmailian
            Mar 22 at 17:14






          • 1




            $begingroup$
            Many thanks, mate! Eye-opener!
            $endgroup$
            – Boris Burkov
            Mar 22 at 17:23













          9












          9








          9





          $begingroup$

          I think the answer of @ShubhamPanchal is a little bit misleading. Yes, it is true that by Cybenko's universal approximation theorem we can approximate $f(x)=x^2$ with a single hidden layer containing a finite number of neurons can approximate continuous functions on compact subsets of $mathbbR^n$, under mild assumptions on the activation function.




          But the main problem is that the theorem has a very important
          limitation
          . The function needs to be defined on compact subsets of
          $mathbbR^n$
          (compact subset = bounded + closed subset). But why
          is this problematic?
          . When training the function approximator you
          will always have a finite data set. Hence, you will approximate the
          function inside a compact subset of $mathbbR^n$. But we can always
          find a point $x$ for which the approximation will probably fail. That
          being said. If you only want to approximate $f(x)=x^2$ on a compact
          subset of $mathbbR$ then we can answer your question with yes.
          But if you want to approximate $f(x)=x^2$ for all $xin mathbbR$
          then the answer is no (I exclude the trivial case in which you use
          a quadratic activation function).




          Side remark on Taylor approximation: You always have to keep in mind that a Taylor approximation is only a local approximation. If you only want to approximate a function in a predefined region then you should be able to use Taylor series. But approximating $sin(x)$ by the Taylor series evaluated at $x=0$ will give you horrible results for $xto 10000$ if you don't use enough terms in your Taylor expansion.






          share|improve this answer











          $endgroup$



          I think the answer of @ShubhamPanchal is a little bit misleading. Yes, it is true that by Cybenko's universal approximation theorem we can approximate $f(x)=x^2$ with a single hidden layer containing a finite number of neurons can approximate continuous functions on compact subsets of $mathbbR^n$, under mild assumptions on the activation function.




          But the main problem is that the theorem has a very important
          limitation
          . The function needs to be defined on compact subsets of
          $mathbbR^n$
          (compact subset = bounded + closed subset). But why
          is this problematic?
          . When training the function approximator you
          will always have a finite data set. Hence, you will approximate the
          function inside a compact subset of $mathbbR^n$. But we can always
          find a point $x$ for which the approximation will probably fail. That
          being said. If you only want to approximate $f(x)=x^2$ on a compact
          subset of $mathbbR$ then we can answer your question with yes.
          But if you want to approximate $f(x)=x^2$ for all $xin mathbbR$
          then the answer is no (I exclude the trivial case in which you use
          a quadratic activation function).




          Side remark on Taylor approximation: You always have to keep in mind that a Taylor approximation is only a local approximation. If you only want to approximate a function in a predefined region then you should be able to use Taylor series. But approximating $sin(x)$ by the Taylor series evaluated at $x=0$ will give you horrible results for $xto 10000$ if you don't use enough terms in your Taylor expansion.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 22 at 17:09

























          answered Mar 22 at 17:03









          MachineLearnerMachineLearner

          409110




          409110







          • 2




            $begingroup$
            Nice catch! "compact set".
            $endgroup$
            – Esmailian
            Mar 22 at 17:14






          • 1




            $begingroup$
            Many thanks, mate! Eye-opener!
            $endgroup$
            – Boris Burkov
            Mar 22 at 17:23












          • 2




            $begingroup$
            Nice catch! "compact set".
            $endgroup$
            – Esmailian
            Mar 22 at 17:14






          • 1




            $begingroup$
            Many thanks, mate! Eye-opener!
            $endgroup$
            – Boris Burkov
            Mar 22 at 17:23







          2




          2




          $begingroup$
          Nice catch! "compact set".
          $endgroup$
          – Esmailian
          Mar 22 at 17:14




          $begingroup$
          Nice catch! "compact set".
          $endgroup$
          – Esmailian
          Mar 22 at 17:14




          1




          1




          $begingroup$
          Many thanks, mate! Eye-opener!
          $endgroup$
          – Boris Burkov
          Mar 22 at 17:23




          $begingroup$
          Many thanks, mate! Eye-opener!
          $endgroup$
          – Boris Burkov
          Mar 22 at 17:23

















          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%2f47787%2fcan-a-neural-network-compute-y-x2%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

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript