Open mikofski opened 7 years ago
Actually, you could build a model up component by component using the add and edit features in layers.Layer
just like Keras and other models (eg: the modelchain in PVLIB), but it still requires subclasses and sources, like Data to be defined. But this could be an interesting alternative for some people?
metaclasses are used extensively in Carousel, so I think it's a good idea to document how they are used and to set some ground rules for their usage.
metaclasses
Here are some reasons to use metaclasses in Carousel:
__init__
)parameters
attribute anywayadd_parameter()
- not a bad alternative and I see other models like Keras do thisconventions
Since metaclasses are altering the way that classes are created before they are even instantiated, this leads to magic that can be confusing at runtime because it is implicit. The Zen of Python says that explicit is better so rather than inferring objects at runtime, there should be only published objects. All inferred objects should be in dictionaries that are mutable at runtime. For example, in the same way that monkey patching is considered by some a code smell, even though it is sometimes necessary, but editing a dictionary at runtime is fair game.