def custom_transformer(): transformer_ = FunctionTransformer(np.square, np.sqrt, validate=True) transformer_.func_inC = 'pow({x}, 2)' X = np.random.uniform(20, 30, (1000, 10)) transformer_.fit(X) return transformer_