scikit-learn/scikit-learn — pull request #2589 by mblondel (2013-11-14 09:36:41+00:00)
Title: [Proof of concept] Syntactic sugar for pipelines

Inspired by https://github.com/aht/stream.py by @aht

This PR adds a simple syntactic sugar for easily creating pipelines.
```
>>> iris = load_iris()
>>> X, y = iris.data, iris.target
>>> pipeline = StandardScaler() | PCA(n_components=2) | SVC(random_state=0)
>>> pipeline.__class__

>>> y_pred = pipeline.fit(X, y).predict(X)
>>> np.mean(y == y_pred)
0.92000000000000004
```

I used the bitwise or operator because of the similarity between pipelines and UNIX pipes but the right shift operator could be nice too (easier to read and convey the idea of direction):
```
>>> pipeline = StandardScaler() >> PCA(n_components=2) >> SVC(random_state=0)
```