Temporal and Spatial Data Mining with Second-Order Hidden Models