First and Second Order Training Algorithms for Artificial Neural Networks to Detect the Cardiac State