Confused between two python optimization functions [closed]
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
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
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.
add a comment |
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
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.
add a comment |
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
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
python machine-learning scipy
edited Nov 24 '18 at 14:16
Matthieu Brucher
17.7k52445
17.7k52445
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.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 24 '18 at 12:57
zsomkozsomko
4966
4966
add a comment |
add a comment |