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
my config is: target: hydra_sklearn_pipeline.make_pipeline recursive: False
steps_config: # use yaml list syntax to preserve to order
- custom_transformer: target: sklearn.preprocessing.FunctionTransformer
func: np.log1p
then it will report error like this:
File "D:\ProgramFiles\Python\Python37\lib\site-packages\sklearn\preprocessing_function_transformer.py", line 171, in _transform
return func(X, **(kw_args if kw_args else {}))
TypeError: 'str' object is not callable
it's because it treat the function "np.log1p" as string.
so is there any approach to support function parameters?
thanks.
The text was updated successfully, but these errors were encountered:
Thank you for reading the post, and submitting this issue :)
Maybe you can use _partial_ initialization? like the example here.
Alternatively, consider implementing a new transformer class (e.g. MyLogTransformer) and initialize it with Hydra.
my config is:
target: hydra_sklearn_pipeline.make_pipeline
recursive: False
steps_config: # use yaml list syntax to preserve to order
- custom_transformer:
target: sklearn.preprocessing.FunctionTransformer
func: np.log1p
then it will report error like this:
File "D:\ProgramFiles\Python\Python37\lib\site-packages\sklearn\preprocessing_function_transformer.py", line 171, in _transform
return func(X, **(kw_args if kw_args else {}))
TypeError: 'str' object is not callable
it's because it treat the function "np.log1p" as string.
so is there any approach to support function parameters?
thanks.
The text was updated successfully, but these errors were encountered: