Skip to content

AttributeError: 'Graph' object has no attribute 'node' #1494

@amitoengg

Description

@amitoengg

I am getting Graph' object has no attribute 'node' error when i call LabelModel.fit on a simple example. Not sure whats wrong. (adding cardinality param doesnt help)

Installation

Ubuntu subsystem on Windows 10 (same error in standalone Ubuntu)
Python 3.6.7
Same error message on 0.9.0 and 0.9.1

pip3 install snorkel==0.9.0

Collecting snorkel==0.9.0
Downloading https://files.pythonhosted.org/packages/42/12/9c5ac9e097574a0657026af7cd127fddbe8f0888dc4fccedb26a8c29e1b6/snorkel-0.9.0-py3-none-any.whl (131kB)
100% |████████████████████████████████| 133kB 666kB/s
Requirement already satisfied: pandas<0.25.0,>=0.24.0 in /usr/local/lib/python3.6/dist-packages (from snorkel==0.9.0)
Requirement already satisfied: scipy<2.0.0,>=1.2.0 in /usr/local/lib/python3.6/dist-packages (from snorkel==0.9.0)
Requirement already satisfied: tensorboardX<2.0,>=1.6 in /usr/local/lib/python3.6/dist-packages (from snorkel==0.9.0)
Requirement already satisfied: torch<1.2.0,>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from snorkel==0.9.0)
Requirement already satisfied: networkx<3.0,>=2.2 in /usr/local/lib/python3.6/dist-packages (from snorkel==0.9.0)
Requirement already satisfied: tqdm<5.0.0,>=4.29.0 in /usr/local/lib/python3.6/dist-packages (from snorkel==0.9.0)
Requirement already satisfied: numpy<2.0.0,>=1.16.0 in /usr/local/lib/python3.6/dist-packages (from snorkel==0.9.0)
Requirement already satisfied: scikit-learn<0.22.0,>=0.20.2 in /usr/local/lib/python3.6/dist-packages (from snorkel==0.9.0)
Requirement already satisfied: python-dateutil>=2.5.0 in /usr/lib/python3/dist-packages (from pandas<0.25.0,>=0.24.0->snorkel==0.9.0)
Requirement already satisfied: pytz>=2011k in /usr/local/lib/python3.6/dist-packages (from pandas<0.25.0,>=0.24.0->snorkel==0.9.0)
Requirement already satisfied: protobuf>=3.8.0 in /usr/local/lib/python3.6/dist-packages (from tensorboardX<2.0,>=1.6->snorkel==0.9.0)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from tensorboardX<2.0,>=1.6->snorkel==0.9.0)
Requirement already satisfied: decorator>=4.3.0 in /usr/local/lib/python3.6/dist-packages (from networkx<3.0,>=2.2->snorkel==0.9.0)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn<0.22.0,>=0.20.2->snorkel==0.9.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from protobuf>=3.8.0->tensorboardX<2.0,>=1.6->snorkel==0.9.0)
Installing collected packages: snorkel
Successfully installed snorkel-0.9.0

Code

import numpy as np
from snorkel.labeling import LabelModel
L = np.array([[0, 0, -1], [-1, 0, 1], [1, -1, 0]])
Y_dev = [0, 1, 0]
label_model = LabelModel(verbose=False)
label_model.fit(L)

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/snorkel/labeling/model/label_model.py", line 743, in fit
self._create_tree()
File "/usr/local/lib/python3.6/dist-packages/snorkel/labeling/model/label_model.py", line 554, in _create_tree
self.c_tree = get_clique_tree(nodes, [])
File "/usr/local/lib/python3.6/dist-packages/snorkel/labeling/model/graph_utils.py", line 49, in get_clique_tree
S = G2.node[i]["members"].intersection(G2.node[j]["members"])
AttributeError: 'Graph' object has no attribute 'node'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions