Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem exporting to JSON and dict #205

Open
LuisGGon opened this issue Oct 20, 2022 · 0 comments
Open

Problem exporting to JSON and dict #205

LuisGGon opened this issue Oct 20, 2022 · 0 comments

Comments

@LuisGGon
Copy link

LuisGGon commented Oct 20, 2022

Hello.

I have built a CHAID decision tree and I got a tree object with the code
tree_obj = tree.to_tree().
Afterwards, I have tried to save the tree into a dict file with the command
tree_obj.to_dict(),
but I got the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/LuisG/anaconda3/lib/python3.8/site-packages/treelib/tree.py", line 964, in to_dict
    tree_dict = {ntag: {"children": []}}
  File "/home/LuisG/anaconda3/lib/python3.8/site-packages/CHAID/node.py", line 42, in __hash__
    return hash(self.__dict__)
TypeError: unhashable type: 'dict'

Something similar happens when I tried to save the tree as a JSON file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant