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
{{ message }}
Repository navigation
Stricter check_params protocol for DA module would simplify debugging #528
ot.utils.check_params is used rather heavily throughout ot.da functions. The function itself checks for None(s) in the input and returns False if at least one was spotted. Now, there are 2 patters of how check_params is used in the code that are somewhat hard to debug when argument passed is, in fact, "invalid":
fit function works when check_params returns True, otherwise just returns self (example). As there's no exceptions thrown, the downstream code safely assumes that fitting is done.
transform returns the result of the transformation only in case check_params returns True, otherwise returns None (example).
In both cases, it's rather hard to find the cause as the issue is only reported using print statements.
Expected behavior
Suggestion here is rather simple: to follow stricter convention, for example similar to check_array in sklearn. Throwing ValueError in case invalid argument is provided seems to be safer option. What do you think? Happy to make a PR with the changes.
Fit and transport gate the real work on a helper that returns false when any argument is None and only prints the missing names. Fit then falls through and returns the same object.
A private helper in the domain-adaptation module raises ValueError and names every missing required input in one message.
Activity
rflamary commentedon Oct 24, 2023
Make sens, we should also probably move check_param in ot.da and change its name that is too generic.
mvanhorn commentedon Oct 20, 2026
Fit and transport gate the real work on a helper that returns false when any argument is None and only prints the missing names. Fit then falls through and returns the same object.
A private helper in the domain-adaptation module raises ValueError and names every missing required input in one message.
#894