adapt icon indicating copy to clipboard operation
adapt copied to clipboard

Metadata routing in pipeline for adapt.feature_based.FA

Open g-simmons opened this issue 9 months ago • 0 comments

I am using FA wrapped around an sklearn predictor in an sklearn Pipeline. Basically Pipeline([("some_name",FA(SomePredictor()))])

fit and transform methods have signatures:

fit(X, y[, Xt, yt, domains])

fit_estimator(X, y[, sample_weight, ...])

fit_transform(Xs, Xt, ys, yt[, domains])

but set_fit_request and set_transform_request have the following signatures.

set_fit_request(*[, domains])

set_transform_request(*[, domain])

When I call pipeline.fit() without ys and yt, I get:

FA.fit_transform() missing 2 required positional arguments: 'ys' and 'yt'

But when I call it with ys and yt, I get

TypeError: Pipeline.fit got unexpected argument(s) {'ys', 'yt'}, which are not routed to any object.

One would think this could be solved by calling set_fit_request({'ys':True, 'yt':True}), but when I do that, I get errors like:

TypeError: Unexpected args: {'yt'} in transform. Accepted arguments are: {'domain'}

Is there an MWE of using FA in an sklearn Pipeline somewhere?

g-simmons avatar May 13 '25 06:05 g-simmons