Contextual Clustering for Analysis of Functional