Loss Optimization Based Algorithm for Multi-classification of ECG Signal