Hi, I used code similar to the one at http://www.onlamp.com/pub/a/python/2006/02/09/ai_decision_trees.html in order to build an ID3 decision tree using python. I obviously do not want to rebuild this tree every time i need to use it! so i tried to save it using pickle, after building it:
>from cPickle import dump >output = open(path, 'wb') >dump(self.tree, output, -1) >output.close() As soon as I do this, I get the following error: >dump(self.tree, output, -1) >cPickle.PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed How on earth can I solve this!? Rebuilding the tree every time is dumb! I'm sure there is a work around somehow, but I honestly don't have a clue as to what this might be! Any ideas please!? I'm totally lost and stuck! Thanks! Daniel
-- http://mail.python.org/mailman/listinfo/python-list