An active implantable medical device for treating heart failure with vagus nerve stimulation, VNS, comprising: - a generator, adapted to produce VNS pulse bursts according to several different selectable VNS therapy configurations; - a sensor, adapted to generate a signal of activity that is function of the level of current activity of the patient; and - means for controlling the generator as a function of the signal of activity, comprising:. a classifier, adapted to determine in which class is located the level of current activity of the patient among a plurality of classes of activity (T 1...T 4) defined by respective boundaries of the level of activity; and. a controller, adapted to select a respective VNS therapy configuration as a function of the class of activity determined by the classifier, the device being characterized in that the boundaries defining the classes of activity are dynamically modifiable boundaries, and in that it further includes: - means for calibrating the classifier, comprising:. means for historical analysis of the successive current levels of activity of the patient taken during a predetermined period of analysis; and. means for defining the boundaries of the classes of activity (T 1...T 4) as a function of the results of said historical analysis. - a generator, adapted to produce VNS pulse bursts according to several different selectable VNS therapy configurations; - a sensor, adapted to generate a signal of activity that is function of the level of current activity of the patient; and - means for controlling the generator as a function of the signal of activity, comprising:. a classifier, adapted to determine in which class is located the level of current activity of the patient among a plurality of classes of activity (T 1...T 4) defined by respective boundaries of the level of activity; and. a controller, adapted to select a respective VNS therapy configuration as a function of the class of activity determined by the classifier, the device being characterized in that the boundaries defining the classes of activity are dynamically modifiable boundaries, and in that it further includes:. a classifier, adapted to determine in which class is located the level of current activity of the patient among a plurality of classes of activity (T 1...T 4) defined by respective boundaries of the level of activity; and. a controller, adapted to select a respective VNS therapy configuration as a function of the class of activity determined by the classifier, the device being characterized in that the boundaries defining the classes of activity are dynamically modifiable boundaries, and in that it further includes: - means for calibrating the classifier, comprising:. means for historical analysis of the successive current levels of activity of the patient taken during a predetermined period of analysis; and. means for defining the boundaries of the classes of activity (T 1...T 4) as a function of the results of said historical analysis.. means for historical analysis of the successive current levels of activity of the patient taken during a predetermined period of analysis; and. means for defining the boundaries of the classes of activity (T 1...T 4) as a function of the results of said historical analysis.