Confused between two python optimization functions [closed]












0















I was training my multiclass classifier when I came across two optimization functions in Python, one is scipy.optimize.fmin_cg and other is scipy.optimize.minimize. I read the documentation but couldn't figure out much. What are the basic differences between these two and in which specific cases should I use them?










share|improve this question















closed as too broad by desertnaut, petezurich, pirho, blue-phoenox, EdChum Nov 24 '18 at 20:39


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.























    0















    I was training my multiclass classifier when I came across two optimization functions in Python, one is scipy.optimize.fmin_cg and other is scipy.optimize.minimize. I read the documentation but couldn't figure out much. What are the basic differences between these two and in which specific cases should I use them?










    share|improve this question















    closed as too broad by desertnaut, petezurich, pirho, blue-phoenox, EdChum Nov 24 '18 at 20:39


    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.





















      0












      0








      0








      I was training my multiclass classifier when I came across two optimization functions in Python, one is scipy.optimize.fmin_cg and other is scipy.optimize.minimize. I read the documentation but couldn't figure out much. What are the basic differences between these two and in which specific cases should I use them?










      share|improve this question
















      I was training my multiclass classifier when I came across two optimization functions in Python, one is scipy.optimize.fmin_cg and other is scipy.optimize.minimize. I read the documentation but couldn't figure out much. What are the basic differences between these two and in which specific cases should I use them?







      python machine-learning scipy






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 '18 at 14:16









      Matthieu Brucher

      15.8k32141




      15.8k32141










      asked Nov 24 '18 at 12:41









      DudeDude

      166




      166




      closed as too broad by desertnaut, petezurich, pirho, blue-phoenox, EdChum Nov 24 '18 at 20:39


      Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









      closed as too broad by desertnaut, petezurich, pirho, blue-phoenox, EdChum Nov 24 '18 at 20:39


      Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


























          1 Answer
          1






          active

          oldest

          votes


















          2














          If you go to the documentation of the minimize function (doc), after the argument list, the methods are specified with references to articles describing the details.



          You can actually find the following line there: "Method CG uses a nonlinear conjugate gradient algorithm", which is exactly what fmin_cg does. So minimize is a more general function, it can use different functions, by selecting the cg it will do the same as the more specific fmin_cg function. (In the documentation of fmin_cg you can read exactly this: "common interface to all scipy.optimize algorithms for unconstrained and constrained minimization of multivariate functions. It provides an alternative way to call fmin_cg, by specifying method='CG'.")



          So, when should you use fmin_cg? It is also answered in the documentation: "Conjugate gradient methods tend to work better when:




          • f has a unique global minimizing point, and no local minima or other stationary points,

          • f is, at least locally, reasonably well approximated by a quadratic function of the variables,

          • f is continuous and has a continuous gradient,

          • f' is not too large, e.g., has a norm less than 1000,

          • The initial guess, x0, is reasonably close to f ‘s global minimizing point, xopt."


          And when should you use minimize? Minimize is just a collection of optimization algorithms. So the real question is when should you use something else. Well, read the description of the methods in the docs and try to figure out. Possibly find the specific methods which will be called by minimize (like in this case fmin_cg) for some more detailed description.






          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            If you go to the documentation of the minimize function (doc), after the argument list, the methods are specified with references to articles describing the details.



            You can actually find the following line there: "Method CG uses a nonlinear conjugate gradient algorithm", which is exactly what fmin_cg does. So minimize is a more general function, it can use different functions, by selecting the cg it will do the same as the more specific fmin_cg function. (In the documentation of fmin_cg you can read exactly this: "common interface to all scipy.optimize algorithms for unconstrained and constrained minimization of multivariate functions. It provides an alternative way to call fmin_cg, by specifying method='CG'.")



            So, when should you use fmin_cg? It is also answered in the documentation: "Conjugate gradient methods tend to work better when:




            • f has a unique global minimizing point, and no local minima or other stationary points,

            • f is, at least locally, reasonably well approximated by a quadratic function of the variables,

            • f is continuous and has a continuous gradient,

            • f' is not too large, e.g., has a norm less than 1000,

            • The initial guess, x0, is reasonably close to f ‘s global minimizing point, xopt."


            And when should you use minimize? Minimize is just a collection of optimization algorithms. So the real question is when should you use something else. Well, read the description of the methods in the docs and try to figure out. Possibly find the specific methods which will be called by minimize (like in this case fmin_cg) for some more detailed description.






            share|improve this answer




























              2














              If you go to the documentation of the minimize function (doc), after the argument list, the methods are specified with references to articles describing the details.



              You can actually find the following line there: "Method CG uses a nonlinear conjugate gradient algorithm", which is exactly what fmin_cg does. So minimize is a more general function, it can use different functions, by selecting the cg it will do the same as the more specific fmin_cg function. (In the documentation of fmin_cg you can read exactly this: "common interface to all scipy.optimize algorithms for unconstrained and constrained minimization of multivariate functions. It provides an alternative way to call fmin_cg, by specifying method='CG'.")



              So, when should you use fmin_cg? It is also answered in the documentation: "Conjugate gradient methods tend to work better when:




              • f has a unique global minimizing point, and no local minima or other stationary points,

              • f is, at least locally, reasonably well approximated by a quadratic function of the variables,

              • f is continuous and has a continuous gradient,

              • f' is not too large, e.g., has a norm less than 1000,

              • The initial guess, x0, is reasonably close to f ‘s global minimizing point, xopt."


              And when should you use minimize? Minimize is just a collection of optimization algorithms. So the real question is when should you use something else. Well, read the description of the methods in the docs and try to figure out. Possibly find the specific methods which will be called by minimize (like in this case fmin_cg) for some more detailed description.






              share|improve this answer


























                2












                2








                2







                If you go to the documentation of the minimize function (doc), after the argument list, the methods are specified with references to articles describing the details.



                You can actually find the following line there: "Method CG uses a nonlinear conjugate gradient algorithm", which is exactly what fmin_cg does. So minimize is a more general function, it can use different functions, by selecting the cg it will do the same as the more specific fmin_cg function. (In the documentation of fmin_cg you can read exactly this: "common interface to all scipy.optimize algorithms for unconstrained and constrained minimization of multivariate functions. It provides an alternative way to call fmin_cg, by specifying method='CG'.")



                So, when should you use fmin_cg? It is also answered in the documentation: "Conjugate gradient methods tend to work better when:




                • f has a unique global minimizing point, and no local minima or other stationary points,

                • f is, at least locally, reasonably well approximated by a quadratic function of the variables,

                • f is continuous and has a continuous gradient,

                • f' is not too large, e.g., has a norm less than 1000,

                • The initial guess, x0, is reasonably close to f ‘s global minimizing point, xopt."


                And when should you use minimize? Minimize is just a collection of optimization algorithms. So the real question is when should you use something else. Well, read the description of the methods in the docs and try to figure out. Possibly find the specific methods which will be called by minimize (like in this case fmin_cg) for some more detailed description.






                share|improve this answer













                If you go to the documentation of the minimize function (doc), after the argument list, the methods are specified with references to articles describing the details.



                You can actually find the following line there: "Method CG uses a nonlinear conjugate gradient algorithm", which is exactly what fmin_cg does. So minimize is a more general function, it can use different functions, by selecting the cg it will do the same as the more specific fmin_cg function. (In the documentation of fmin_cg you can read exactly this: "common interface to all scipy.optimize algorithms for unconstrained and constrained minimization of multivariate functions. It provides an alternative way to call fmin_cg, by specifying method='CG'.")



                So, when should you use fmin_cg? It is also answered in the documentation: "Conjugate gradient methods tend to work better when:




                • f has a unique global minimizing point, and no local minima or other stationary points,

                • f is, at least locally, reasonably well approximated by a quadratic function of the variables,

                • f is continuous and has a continuous gradient,

                • f' is not too large, e.g., has a norm less than 1000,

                • The initial guess, x0, is reasonably close to f ‘s global minimizing point, xopt."


                And when should you use minimize? Minimize is just a collection of optimization algorithms. So the real question is when should you use something else. Well, read the description of the methods in the docs and try to figure out. Possibly find the specific methods which will be called by minimize (like in this case fmin_cg) for some more detailed description.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 24 '18 at 12:57









                zsomkozsomko

                4966




                4966

















                    Popular posts from this blog

                    404 Error Contact Form 7 ajax form submitting

                    How to know if a Active Directory user can login interactively

                    TypeError: fit_transform() missing 1 required positional argument: 'X'