Class PeakDetection

  • All Implemented Interfaces:
    IPeakDetector

    public class PeakDetection
    extends Object
    implements IPeakDetector
    Peak detection is a designed to find dominant peaks of a time series based on the settings provided by the user. For a peak to be considered dominant, three constraints can be set: a threshold on the frequency domain, a minimum peak-to-peak distance, and a maximum number of dominant peaks.
    The main task is done in the method findPeaks which initially finds all the peaks (i.e., any data point whose value is larger than both of its previous and next neighbors), sorts them by their height, and then removes those which do not fall into the set constraints.
    Author:
    Azim Ahmadzdeh, Data Mining Lab, Georgia State University
    • Constructor Detail

      • PeakDetection

        public PeakDetection​(int width,
                             double threshold,
                             int n,
                             boolean isPercentile)
        Constructor for the class PeakDetection.
        Parameters:
        width - is the radius of the neighborhood of an accepted peak within which no other peaks is allowed. To relax this condition, set it to 1 or 0. The results would be similar, i.e., no peaks will be removed because of the neighboring constraints.
        threshold - on the frequency domain of the time series below which all the peaks will be ignored.
        Note: To relax this condition, set it to the minimum values of the given sequence, and not to zero, unless the sequence is guaranteed to have positive values only.
        n - the maximum number of peaks to be found, from the highest to lowest. If n=0, all of the detected peaks will be returned.
        isPercentile - if true, then the value of threshold is interpreted as the percentile. Then the accepted values are doubles within [0,100]. If false, then the given double value will be used directly as the actual threshold on the frequency domain.
    • Method Detail

      • findPeaks

        public List<Integer> findPeaks​(double[] data)
        This method finds the peaks of the given time series based on the constraints provided for the class.
        Important: The returned list is sorted by the height of the peaks, so the indices are not ordered.
        Specified by:
        findPeaks in interface IPeakDetector
        Parameters:
        data - The input array to find local maxima in.
        Returns:
        List of index locations of the found local maxima. The list may or may not be sorted by the height of the peaks, depending on the method implements this interface.
      • findCandidatePeaks

        public static List<Integer> findCandidatePeaks​(double[] data)
        It finds the position of any peaks on the time series.
        Parameters:
        data -
        Returns:
        List of peak index locations
      • makeTreemapUsingCollections

        public static void makeTreemapUsingCollections​(Map<Integer,​Double> m,
                                                       List<Integer> peaks,
                                                       double[] data)