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
When calling the fit method of a class like h2o.sklearn.H2OAutoMLRegressor and passing not only standard params X and y but also additional non-standard custom params which are bound to variable keyword param **fit_params, those fit_params will not be passed on correctly to the actual fit function by the fit function's decorator that has been created beforehand by h2o/sklearn/wrapper.py#params_as_h2o_frames. Instead those fit_params will end up one level too deeply nested in an envelope of type dictionary so that the decorated fit function cannot bind them anymore.
I have been able to fix the problem in my copy of the code by putting the following snippet into function params_as_h2o_frames:
{{
# PATCH BEGIN
# this patch is to ensure that custom keyword params bound to a var keyword parameter like fit_params
# are forwarded to the wrapped function fn in an unpacked way rather than as items of a dictionary
# which would not be recognised by the function fn
# result = fn(_args) # this is the original line of code being replaced by the modified version to follow
var_keyword_param = {}
for param_name in sig.parameters.keys():
if sig.parameters[param_name].kind == Parameter.VAR_KEYWORD:
var_keyword_param = _args.pop(param_name)
break # there can only be at most one parameter of kind VAR_KEYWORD in any function signature
result = fn(**_args, **var_keyword_param)
# PATCH END
}}
The text was updated successfully, but these errors were encountered:
When calling the fit method of a class like h2o.sklearn.H2OAutoMLRegressor and passing not only standard params X and y but also additional non-standard custom params which are bound to variable keyword param **fit_params, those fit_params will not be passed on correctly to the actual fit function by the fit function's decorator that has been created beforehand by h2o/sklearn/wrapper.py#params_as_h2o_frames. Instead those fit_params will end up one level too deeply nested in an envelope of type dictionary so that the decorated fit function cannot bind them anymore.
I have been able to fix the problem in my copy of the code by putting the following snippet into function params_as_h2o_frames:
{{
# PATCH BEGIN
# this patch is to ensure that custom keyword params bound to a var keyword parameter like fit_params
# are forwarded to the wrapped function fn in an unpacked way rather than as items of a dictionary
# which would not be recognised by the function fn
# result = fn(_args) # this is the original line of code being replaced by the modified version to follow
var_keyword_param = {}
for param_name in sig.parameters.keys():
if sig.parameters[param_name].kind == Parameter.VAR_KEYWORD:
var_keyword_param = _args.pop(param_name)
break # there can only be at most one parameter of kind VAR_KEYWORD in any function signature
result = fn(**_args, **var_keyword_param)
# PATCH END
}}
The text was updated successfully, but these errors were encountered: