I've noticed some odd behavior on the current master that seems like a bug.
>>> m = MyModel()
>>> f=modeling.fitting.NonLinearLSQFitter()
>>> f(m,x,y)
<MyModel(a=Parameter('a', value=1.5), b=Parameter('b', value=-3.0), param_dim=1)>
>>> m2 = MyModel()
>>> m2.a.bounds = (-2,2) # same if I do e.g. m2.a.bounds = (0, None)
>>> f2=modeling.fitting.NonLinearLSQFitter()
>>> f2(m2,x,y)
<MyModel(a=Parameter('a', value=1.0), b=Parameter('b', value=0.0), param_dim=1)>
That looks wrong. It seems like adding the bounds to m2 has caused it to stop trying to fit. And indeed, here's what the fitter says:
>>>f2.fit_info['message']
'The cosine of the angle between func(x) and any column of the\n Jacobian is at most 0.000000 in absolute value'
>>>f2.fit_info['fjac']
array([[-0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., -0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.]])
So apparently the jacobian is coming out to be all zeros?? Why would setting bounds do this despite the initial value being well inside the bounds?
I've noticed some odd behavior on the current master that seems like a bug.
With that model defined, I see the following:
That looks wrong. It seems like adding the bounds to
m2has caused it to stop trying to fit. And indeed, here's what the fitter says:So apparently the jacobian is coming out to be all zeros?? Why would setting bounds do this despite the initial value being well inside the bounds?