Closed hmgaudecker closed 5 years ago
~Hmmm, this seems to be related to fixing some parameters to values other than the start value.~
~In the first shot, which yielded the warning, I had not bothered about the start values of 0.1 for some constants fixed to zero in an AR(1) equation.~
~Doing so also seems to have removed the above.~
Nope, the reason was just that I had not restarted the Kernel and Numba did not need to recompile.
Yes, the warning when you fix a parameter to a different value than it's start value is just a harmless estimagic warning.
I am very sure that translog did compile in nopython mode, so it must somehow be related to your specific inputs or the changed data structures.
Could you pickle the output of SkillModel.likelihood_arguments_dict
and send them to me? Since this will contain parts of your dataset you should not post it publicly and ideally use a model instance generated from a small subset of your data.
Thanks. Can't do that for privacy reasons. You will need to tell me what I should be looking for, I am afraid.
I'm happy if you do the debugging for me :-). I don't really know what I would be looking for. Probably some empty lists / tuples /arrays or slices thereof, that only occur in your constellation.
The inputs for the translog function will be in likelihood_arguments_dict["predict_args"]["transform_sigma_point_args"]["transition_argument_dicts"]
(I know that's not ideal ...) and this does not contain raw data or enough information to reconstruct data even if someone was willing to write the inverse of a Kalman Filter to get at your data.
Okay, that is indeed just a bunch of zeros, see below.
~The problem is very likely the last one, where the coeffs array is empty. I probably put in a restriction too many in my attempt to re-create the AR(1) specification. Will have to check later.~
~If my assertion is correct, it seems like this would be worth a testcase and a graceful error message now that more responsibility for restrictions is with the user.~
I just realise this happens in every element. I have five factos (constant, translog, translog, AR(1), AR(1)) and four periods So I guess this sorts the factors by their names and the constant one is last. Then this looks right.
[
[
{"coeffs": array([0.0, 0.0, 0.0]), "included_positions": (0, 4)},
{"coeffs": array([0.0, 0.0, 0.0]), "included_positions": (1, 4)},
{
"coeffs": 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]),
"included_positions": (0, 1, 2, 3, 4),
},
{"coeffs": array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), "included_positions": (1, 3, 4)},
{"coeffs": array([], dtype=float64), "included_positions": (4,)},
],
[
{"coeffs": array([0.0, 0.0, 0.0]), "included_positions": (0, 4)},
{"coeffs": array([0.0, 0.0, 0.0]), "included_positions": (1, 4)},
{
"coeffs": 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]),
"included_positions": (0, 1, 2, 3, 4),
},
{"coeffs": array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), "included_positions": (1, 3, 4)},
{"coeffs": array([], dtype=float64), "included_positions": (4,)},
],
[
{"coeffs": array([0.0, 0.0, 0.0]), "included_positions": (0, 4)},
{"coeffs": array([0.0, 0.0, 0.0]), "included_positions": (1, 4)},
{
"coeffs": 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]),
"included_positions": (0, 1, 2, 3, 4),
},
{"coeffs": array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), "included_positions": (1, 3, 4)},
{"coeffs": array([], dtype=float64), "included_positions": (4,)},
],
[
{"coeffs": array([0.0, 0.0, 0.0]), "included_positions": (0, 4)},
{"coeffs": array([0.0, 0.0, 0.0]), "included_positions": (1, 4)},
{
"coeffs": 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]),
"included_positions": (0, 1, 2, 3, 4),
},
{"coeffs": array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), "included_positions": (1, 3, 4)},
{"coeffs": array([], dtype=float64), "included_positions": (4,)},
],
]
This looks like a bug, not a user error. The coeffs array is constructed based on the number of included positions.
Just to locate the problem: If I remember correctly you got the error in a translog function. Are you trying to express the AR1 Process as translog? Or as a linear function (which would be easier and probably faster)
AR(1) is linear + restrictions.
Yes, the only problem seems to be that included_positions is a tuple, not an array. Will be fixed soon.
Version 0.0.60 gives a NumbaDepreciationWarning for the translog function because it falls back to object mode (=no speed improvement), they will disable that in the future.
Solution: Either make compliant with Numba's supported features of Python or remove the decorator.
NB: Most of the stuff below seems repetitive, but I did not check super-carefully whether some part is not, so I rather dump the whole output...