You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
), have a bunch of loading in the __init__. This is discuraged in the context of tpcp/sklearn and similar frameworks, as the idea is that parameters can be modified even after the init (using set_params) and the assumption is that creating an instance is "cheap" and it is hence done under the hood often (e.g. via .clone).
All logic should be put where it is first needed (aka in detect or train method)
The text was updated successfully, but these errors were encountered:
I tried to address your raised Issue in: fa2b888 & e14b7c2 .
This moves the computation heavy Stuff out of the initialization and places them where they are first used / in separate function. Is this a correct fix for you addressed Issue @AKuederle ?
There are still computations in the respective inits. The parameters of an algorithm can (and will be changed, e.g. in a gridsearch) without rerunning the init. In result dependent computations that only exist in the init become out of sync.
Further, you need to always rerun all dependent computations. Assume that parameters can change between executions. Then you must not rely on pre-loaded values that where potentially calulated based on other parameters.
If you want to cache expensive computations, use proper caching that tracks inputs.
Btw. you also don't need to initilize result variables and others in the init. You can just set the typehints in the class body and then set them when needed.
I saw that at least in one of the algorithms implemented here (
eargait/eargait/gait_sequence_detection/gait_sequence_detector.py
Line 93 in ffd8336
__init__
. This is discuraged in the context of tpcp/sklearn and similar frameworks, as the idea is that parameters can be modified even after the init (usingset_params
) and the assumption is that creating an instance is "cheap" and it is hence done under the hood often (e.g. via.clone
).All logic should be put where it is first needed (aka in detect or train method)
The text was updated successfully, but these errors were encountered: