Changed distribution keyword, casted some attributes to float, remove… #3784
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #3783, but there were other issues discovered underneath these fixes.
The incoming object to be serialized has the structure
self._distribution['distribution']['mean']
,self._distribution['distribution']['stdev']
etc, but the write method expectsself._distribution['distributionParams']['mean']
(anomaly_likelihood.py line 318-321)The read method did not expect
distribution
ordistributionParams
(anomaly_likelihood.py line 274-279) thus when the serialized object was read back into memory it did not have a matching structure.The incoming values cannot be serialized by capnproto because they have the type
numpy.float64
, so we cast them tofloat
(which is a double) (anomaly_likelihood.py line 318-321)The AnomalyLikelihoodRegion.capnp file uses
Float32
(not a double) instead ofFloat64
.@rhyolight I'm one of the developers working on Grok, we need to use these serialization methods, if you want some time to talk on the phone about these changes I would be happy to do that. There is some confusion here as to how you guys are serializing datetimes, looks like you just save an integer in place of it to preserve order, (why not serialize a timestamp and recreate the datetime object?)
Please do look over this code though, because it throws a fatal KeyError as is. Greatly appreciate all the help given on the forums!