I want to cluster my data first using k-means and then determine a regression model for each cluster. Then I want to evaluate the performance of this approach using split validation. I can think of two alternative approaches for that:
a) clustering the complete data set and then splitting each cluster into a testing and training data set for training and evaluating the linear models
b) splitting the complete data set first into a training and testing data set, then clustering and learning the linear models on the training data, while testing the results with the test data
So, in other words, when is it more appropriate to split the data: before or after the clustering step? Which approach is more reasonable?