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

AttributeError: type object 'EdgeCategoricalAttribute' has no attribute 'NodeCategoricalAttribute' #200

Closed
Sumaiya1229 opened this issue Jun 5, 2021 · 2 comments

Comments

@Sumaiya1229
Copy link
Contributor

Hi!
I am a beginner who is trying to learn NDlib for my thesis. I have been following the NDlib documentation. I was trying to run the code given on the link below for Node Categorical Attribute

[https://ndlib.readthedocs.io/en/latest/custom/compartments/NodeCategoricalAttribute.html]

while I was running I got the attribute error: type object 'EdgeCategoricalAttribute' has no attribute 'NodeCategoricalAttribute'

Can anyone help me with that?

Thanks!

@jameshughes89
Copy link
Contributor

I believe the issue is the import ndlib.models.compartments.NodeCategoricalAttribute as ns and c1 = na.NodeCategoricalAttribute("Sex", "male", probability=0.6)

Either (a) change the import to something like this
import ndlib.models.compartments.NodeCategoricalAttribute as nca
and create the object like this
c1 = nca("Sex", "male", probability=0.6)

or (b):
import ndlib.models.compartments as cpm
and create the object like this
c1 = cpm.NodeCategoricalAttribute("Sex", "male", probability=0.6)

https://github.com/GiulioRossetti/ndlib/blob/master/docs/custom/compartments/NodeCategoricalAttribute.rst

Either way, the example has some issues.

@jameshughes89
Copy link
Contributor

Should close now. I used fix wrong.

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

3 participants