python - Scpiy: strange behavior of scipy.optimize.minimize -


i'm doing minization using scipy.optimize.minimize.

in looking proper argument x0 target function f(x0), x0 has sudden change, , value turns nan, minimize method stopped.

here x0 , result series before strange behaviro:

[ 0.1329492   0.13074885 -9.92951618 -1.15521653  5.74419133  4.11687514   0.19983624 -9.95148156 -1.18517543  5.69420641  3.91303028  0.19983624  -7.34387457 -5.30116147  4.90141309  5.06593156  0.18205401] 267.765197762 [ 0.1329492   0.13074885 -9.92951618 -1.15521653  5.74419133  4.11687514   0.19983624 -9.95148156 -1.18517543  5.69420641  3.91303028  0.19983624  -7.34387457 -5.30116149  4.9014131   5.06593156  0.18205401] 267.76519813 [ 0.1329492   0.13074885 -9.92951618 -1.15521653  5.74419133  4.11687514   0.19983624 -9.95148156 -1.18517543  5.69420641  3.91303028  0.19983624  -7.34387457 -5.30116149  4.90141309  5.06593157  0.18205401] 267.765196949 [ 0.1329492   0.13074885 -9.92951618 -1.15521653  5.74419133  4.11687514   0.19983624 -9.95148156 -1.18517543  5.69420641  3.91303028  0.19983624  -7.34387457 -5.30116149  4.90141309  5.06593156  0.18205402] 267.765198923 [  5.93742471e-01   4.06257529e-01  -5.09322593e+00   1.73303924e+00    3.56252177e+00   2.98573010e+00   1.26090655e-09  -4.85059563e+00    1.22511256e+00   4.81903606e+00   2.51934646e+00   5.72130981e-10   -1.06593289e+01   2.76365721e+00   4.63158974e+00   6.86179361e+00    1.29879685e-09] nan 

after chaning around [ 0.1329492 0.13074885 ..., x0 change [ 5.93742471e-01 4.06257529e-01 ..., , returns nan.

the strange thing is, target method f(x0) can return value last x0([ 5.93742471e-01 4.06257529e-01 ...]).

i have no idea this.

i'm not quite sure reason because don't have target function or call scipy.optimize.minimize() can see this:

the first , second-to last x different 1*10^-8, in 2 of components. seems extremely little.

if did not specify otherwise, minimize decides based on whether specified constraints (have @ doc string). there's chance end bfgs or similar, based on gradients. now, if tried construct gradient based on first few evaluations, can see how lead crazy results such small spacing.

the question is: did maybe led these small starting intervals? did specify algorithm use? did specify bounds might have triggered small initial intervals? generally, not set bounds unless there's reason not go someplace. many people set bounds merely on basis of "i don't think there solutions here" -- that's bad habit , has confused many algorithm!

for better analysis, should post more information. depending on problem, might find least-squares method or simplex optimizer may better, maybe genetic algorithm, given number of input variables.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -