Predicting the descent into extremism and terrorism