Browse code

implement __getstate__ and __setstate__ in BaseLearner

Bas Nijholt authored on 07/09/2017 10:40:37
Showing 1 changed files
... ...
@@ -102,6 +102,12 @@ class BaseLearner(metaclass=abc.ABCMeta):
102 102
             The number of points to choose.
103 103
         """
104 104
 
105
+    def __getstate__(self):
106
+        return copy(self.__dict__)
107
+
108
+    def __setstate__(self, state):
109
+        self.__dict__ = state
110
+
105 111
 class AverageLearner(BaseLearner):
106 112
     def __init__(self, function, atol=None, rtol=None):
107 113
         """A naive implementation of adaptive computing of averages.