An adaptive dual chamber pacemaker and/or cardioverter defibrillator for delivering ventricular stimulation to the heart correlated with hemodynamic performance of the heart, including a hemodynamic sensor for monitoring the hemodynamic performance of the heart, an atrial electrode and a ventricular electrode for sensing ventricular and atrial signals, and a learning module having a spiking neural network processor for learning to associate the ventricular-atrial intervals sensed by the electrodes with the hemodynamic performance sensed by the hemodynamic sensor, calculating ventricular-atrial intervals, replacing the ventricular-atrial intervals calculated from the sensed ventricular and atrial signals with the learned associated ventricular-atrial intervals, and causing delivery according to the learned associated ventricular-atrial intervals of a ventricular stimulation to the heart during atrial fibrillation episodes.