ThresholdBased

class eyefeatures.preprocessing.aoi_extraction.ThresholdBased(x=None, y=None, window_size=None, threshold=None, pk=None, aoi_name=None, algorithm_type='kmeans', threshold_dist=None)[source]

Bases: BaseAOIPreprocessor

Defines the AOI for each fixation using density maximum and Kmeans. Finds local maximum, pre-threshold it, and uses it as a center of aoi.

Parameters:
  • x (str) – x coordinate of fixation.

  • y (str) – y coordinate of fixation.

  • window_size (int) – size of search window.

  • threshold (float) – threshold density.

  • pk (list[str]) – list of column names used to split pd.DataFrame.

  • aoi_name (str) – name of AOI column.

  • algorithm_type (str) – type of clustering algorithm to use.

  • threshold_dist (float) – maximum allowed distance between fixations in single AOI.

Algorithm

  1. Split the graph into a grid and compute density for each sector via gaussian kernel density estimation.

  2. Pre-threshold it.

  3. Find the local maxima. Every maximum is a center of area of interest.

  4. Start to define AOI for each fixation.

  5. If `algorithm_type` is default, then it starts KMeans. Otherwise, if `algorithm_type='basic'`, then it starts to search for the for the nearest fixation with AOI and assigns this label to the target fixation.

  6. Repeat for all instances.