Modeling Market States with Clustering and State Machines