Skip to content

Adding attributes to class pso #5

@ShaikhaTheGreen

Description

@ShaikhaTheGreen

Hello @caio-davi,

I hope you can assist me with this simple issue (but for some reason won't resolve). I tried adding an attribute to the class pso in pso_adam.py. In other words, I added self.weight_flag to the list of variables in __init__(), but whenever I try to use it inside fitness_fn(self, x) or any other function, the compiler throws this error:

'pso' object has no attribute 'weight_flag'

I checked my indentation and I tried multiple editors. I also tried renaming the class to 'pso_adam'. None of these trials resolved the error, but I can't seem to know what is causing the error.

My question is: If I want tot add more attributes to the pso class in pso_adam.py, what is the best way to do it?

Thanks again for this great work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions