Classification of real-time traffic speed patterns to predict crashes on freeways