A medical system comprising: an implantable medical device (IMD) comprising a stimulation generator configured to deliver, via at least one electrode, electrical stimulation to one or more nerves in the pelvic floor of a patient according to a plurality of electrical stimulation parameter sets, each electrical stimulation parameter set of the plurality of electrical stimulation parameter sets defining a respective electrical stimulation signal deliverable to the patient; and one or more processors configured to: obtain, for each electrical stimulation parameter set of the plurality of electrical stimulation parameter sets, a respective signal representative of an electrical response sensed from the patient in response to the electrical stimulation delivered to the one or more nerves in the pelvic floor of the patient according to the respective electrical stimulation parameter set; determine, based on the obtained respective signals, a primary electrical stimulation parameter set that defines electrical stimulation therapy deliverable to the patient by the stimulation generator; and control delivery, by the IMD , of the electrical stimulation therapy to one or more nerves in the pelvic floor of the patient according to the primary electrical stimulation parameter set. an implantable medical device (IMD) comprising a stimulation generator configured to deliver, via at least one electrode, electrical stimulation to one or more nerves in the pelvic floor of a patient according to a plurality of electrical stimulation parameter sets, each electrical stimulation parameter set of the plurality of electrical stimulation parameter sets defining a respective electrical stimulation signal deliverable to the patient; and one or more processors configured to: obtain, for each electrical stimulation parameter set of the plurality of electrical stimulation parameter sets, a respective signal representative of an electrical response sensed from the patient in response to the electrical stimulation delivered to the one or more nerves in the pelvic floor of the patient according to the respective electrical stimulation parameter set; determine, based on the obtained respective signals, a primary electrical stimulation parameter set that defines electrical stimulation therapy deliverable to the patient by the stimulation generator; and control delivery, by the IMD , of the electrical stimulation therapy to one or more nerves in the pelvic floor of the patient according to the primary electrical stimulation parameter set. obtain, for each electrical stimulation parameter set of the plurality of electrical stimulation parameter sets, a respective signal representative of an electrical response sensed from the patient in response to the electrical stimulation delivered to the one or more nerves in the pelvic floor of the patient according to the respective electrical stimulation parameter set; determine, based on the obtained respective signals, a primary electrical stimulation parameter set that defines electrical stimulation therapy deliverable to the patient by the stimulation generator; and control delivery, by the IMD , of the electrical stimulation therapy to one or more nerves in the pelvic floor of the patient according to the primary electrical stimulation parameter set. <EOS>