Clustering Event Trajectories with Machine Learning: An Approach for Electronic Healthcare Records