Pipelining and cross-validation

Integration with sklearn pipelines

Wrapped estimators can be used in sklearn pipelines without any additional overhead:

>>> from sklearn_xarray import wrap, Target
>>> from sklearn_xarray.datasets import load_digits_dataarray
>>> from sklearn.pipeline import Pipeline
>>> from sklearn.decomposition import PCA
>>> from sklearn.linear_model.logistic import LogisticRegression
>>>
>>> X = load_digits_dataarray()
>>> y = Target(coord='digit')(X)
>>>
>>> pipeline = Pipeline([
...     ('pca', wrap(PCA(n_components=50), reshapes='feature')),
...     ('cls', wrap(LogisticRegression(), reshapes='feature'))
... ])
>>>
>>> pipeline.fit(X, y)  
Pipeline(...)
>>> pipeline.score(X, y)
1.0