Compact Neural Network Algorithm for Electrocardiogram Classification