How to export an instance of ADWIN class in JSON #1456
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hey there. I'm curious, why are you limited to not using a byte stream? |
Beta Was this translation helpful? Give feedback.
-
In an ideal world, River class should be JSON-serializable. For instance, we could that by using Pydantic everywhere. Alas, we're not there yet. What you could do in the meantime is write a custom JSON serializer/parser. This would be basically mean converting ADWIN to a dict, and also instantiate ADWIN from a dict. There's some good examples here. Do you see what I mean? |
Beta Was this translation helpful? Give feedback.
-
To accomplish my goal I modified the original library, in particular editing four classes: I modified the class Base from river/base/base.py adding these two methods:
Then I modified two classes within river/base/drift_detector.py :
Then in river/drift/adwin_c.pyx I added these methods in the AdaptiveWindowing class:
(keep in mind that the original code was in cython while I rewrote in in python and added these methods).
|
Beta Was this translation helpful? Give feedback.
To accomplish my goal I modified the original library, in particular editing four classes:
I modified the class Base from river/base/base.py adding these two methods: