Validation of an algorithm for automated classification of migraine and tension-type headache attacks in an electronic headache diary