Closed pipme closed 2 years ago
Hi Chengkun, thanks for catching this! My instinct is that function_logger.Xn
should remain as the index of the most recently evaluated point, and that we should correct this issue by setting self.optim_state["N"] = self.function_logger.Xn + 1
, though I can see an argument either way.
I'll correct this on the branch nan-bug-function-logger
and make sure it works, but it should be a simple fix. Can I ask how you noticed the issue, so I can keep an eye out for similar subtle bugs?
Hi Bobby, thanks for fixing that. Yes maybe it's better to simply add 1 to Xn. I noticed it when I try to implement something depending on the number of training points. Later I can add another variable like self.n_train = self.Xn + 1
to FuntionLogger if needed. But for now I think this simple fix is enough : )
Resolved in #75 .
In python
self.Xn: int = -1 # Last filled entry
while in matlab it starts from 0 due to difference in indexing. This causes a problem when we want to get current number of training inputs byTwo solutions: either we replace the above with
self.optim_state["N"] = self.function_logger.Xn + 1
or we setself.Xn: int = 0
and modify the related indexing parts inFunctionLogger
.What do you think? @Bobby-Huggins @lacerbi