I have a sklearn pipeline, which extracts three different features.
manual_feats = Pipeline([
('FeatureUnion', FeatureUnion([
('segmenting_pip1', Pipeline([
('A_features', A_features()),
('segmentation', segmentation())
])),
('segmenting_pip2', Pipeline([
('B_features', B_features(),
('segmentation', segmentation())
])),
('segmenting_pip3', Pipeline([
('Z_features', Z_features()),
('segmentation', segmentation())
])),
])),
])
Given that the features A and B each returns an array of dim (# of records, 10, 20), while Z returns (# of records, 10, 15).
When I fit the pipeline with all the feature I get this error:
File "C:\Python35\lib\site-packages\sklearn\pipeline.py", line 451, in _transform
Xt = transform.transform(Xt)
File "C:\Python35\lib\site-packages\sklearn\pipeline.py", line 829, in transform
Xs = np.hstack(Xs)
File "C:\Python35\lib\site-packages\numpy\core\shape_base.py", line 340, in hstack
return _nx.concatenate(arrs, 1)
ValueError: all the input array dimensions except for the concatenation axis must match exactly
But if I exclude feature Z the pipeline works but the concatenation applied on the axis=1 dim (# of records, 20, 20). What I want to is to get an array of (# of records, 10, 40) dimension, where the concatenation process applied on axis=2.
How can I get what I want using Pipeline and without editing the source code of the library?
Edit:
I mentioned that the concatenation of A and B produces an array of (# of records, 10, 40) DIM. This not correct; it produces an array of DIM (# of records, 20, 20). I'll edit the question.