Skip to content

Initialization of NMF parameters #1

Description

@marianotepper

All the different methods initializers are calling the initializer of the parent class. For example, here:
nmf_std.Nmf_std.__init__(self, vars())
This is done in all the different NMF flavors, each calling the corresponding initializer.

I have two comments about this way of initializing things:

  1. Wouldn't it be more pythonic to use super instead? It would also reduce the possibility of calling the wrong initializer by mistake.

  2. vars() contains a reference to self, so in practice every instance contains a self-reference (self.self) after initialization. Although it does not hurt, I believe that this reference should be eliminated from the vars dictionary. This can be done in each subclass, e.g.,

        params = vars()
        del params['self']
        nmf_std.Nmf_std.__init__(self, params)

It can also be done in the base class itself (Nmf_std in this case) to avoid code repetition.

I believe that making these simple and quick changes would improve object initialization in the library.

Metadata

Metadata

Assignees

No one assigned

    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