Clustering piecewise stationary processes