Prediction and control with temporal segment models