A medical device detects a previously defined event, and controls delivery of therapy to a patient according to therapy information associated with the previously defined event. In exemplary embodiments, the medical device enters a learning mode in response to a command received from a user, e.g., the patient or a clinician. In such embodiments, the medical device defines the event, collects the therapy information, and associates the therapy information with the defined event while operating in the learning mode. In some embodiments, the medical device defines the event based on the output of a sensor that indicates a physiological parameter of the patient during the learning mode. The sensor may be an accelerometer, which generates an output that reflects motion and/or posture of the patient. The medical device may collect therapy information by recording therapy changes made by the user during the learning mode.