Commits

Aleš Erjavec  committed 5cfa715

Fixed pickling of Boosted/Bagged/StackedLearner.

  • Participants
  • Parent commits 80bbc6b

Comments (0)

Files changed (3)

File Orange/ensemble/bagging.py

         return BaggedClassifier(classifiers=classifiers, name=self.name, \
                     class_var=instances.domain.class_var)
 
+    def __reduce__(self):
+        return type(self), (self.learner,), dict(self.__dict__)
+
 BaggedLearner = Orange.utils.deprecated_members(
     {"weightId": "weight_id", "examples": "instances"}
     )(BaggedLearner)

File Orange/ensemble/boosting.py

         instances.removeMetaAttribute(weight)
         return BoostedClassifier(classifiers = classifiers, name=self.name, 
             class_var=instances.domain.class_var)
+
+    def __reduce__(self):
+        return type(self), (self.learner,), dict(self.__dict__)
+
 BoostedLearner = Orange.utils.deprecated_members({"examples":"instances", "classVar":"class_var", "weightId":"weigth_id", "origWeight":"orig_weight"})(BoostedLearner)
 
 class BoostedClassifier(orange.Classifier):

File Orange/ensemble/stacking.py

         feature_domain = Orange.data.Domain(features)
         return StackedClassifier(classifiers, meta_classifier, name=self.name)
 
+    def __reduce__(self):
+        return type(self), (self.learner,), dict(self.__dict__)
+
+
 class StackedClassifier:
     """
     A classifier for stacking. Uses a set of level-0 classifiers to induce class probabilities, which