1. A method performed by one or more computers, comprising: receiving a plurality of motion features, each of the motion features including a time series of motion vectors; clustering the motion features into one or more motion clusters; and representing each of the one or more motion clusters using a motion pattern for recognizing a gesture on a mobile device, the motion pattern including a time series of calculated motion vectors.