Temporal and spatial data mining with second-order hidden markov models