Skip to content

How to export an instance of ADWIN class in JSON #1456

Discussion options

You must be logged in to vote

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:

def to_dict(self):
     """
     Convert the Base instance to a dictionary.

     Returns:
         dict: A dictionary representation of the Base instance.
     """
     clone_instance = self.clone(include_attributes=True)
     params = clone_instance._get_params()
     return params

 @classmethod
 def from_dict(cls, data):
     """
     Create a Base instance from a dictionary.

     Args:
         data (dict): Dictionary containing the serialized Base data.

     Returns:
         Base: A new Base instance.
     """
     …

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@LorenzoCutrupi
Comment options

Comment options

You must be logged in to vote
2 replies
@LorenzoCutrupi
Comment options

@MaxHalford
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by LorenzoCutrupi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants