Class PeakDetection
- java.lang.Object
-
- edu.gsu.cs.dmlab.imageproc.imageparam.util.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 methodfindPeaks
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 Summary
Constructors Constructor Description PeakDetection(int width, double threshold, int n, boolean isPercentile)
Constructor for the class PeakDetection.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<Integer>
findCandidatePeaks(double[] data)
It finds the position of any peaks on the time series.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.static void
makeTreemapUsingCollections(Map<Integer,Double> m, List<Integer> peaks, double[] data)
-
-
-
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. Ifn=0
, all of the detected peaks will be returned.isPercentile
- iftrue
, then the value ofthreshold
is interpreted as the percentile. Then the accepted values are doubles within [0,100]. If false, then the givendouble
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 interfaceIPeakDetector
- 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
-
-