class_docstr: Bitmap Algorithm.
  This method breaks time series into chunks and uses the frequency of similar chunks
  to determine anomaly scores.
  The ideas are from this paper:
  Assumption-Free Anomaly Detection in Time Series(http://alumni.cs.ucr.edu/~ratana/SSDBM05.pdf).
class_docstr_tok: ["Bitmap","Algorithm",".","This","method","breaks","time","series","into","chunks","and","uses","the","frequency","of","similar","chunks","to","determine","anomaly","scores",".","The","ideas","are","from","this","paper",":","Assumption-Free","Anomaly","Detection","in","Time","Series","(","http",":","\/\/alumni.cs.ucr.edu\/~ratana\/SSDBM05.pdf",")","."]
docstr: Construct the chunk dicts for lagging window and future window at each index.
   e.g: Suppose we have a SAX sequence as '1234567890', both window sizes are 3, and the chunk size is 2.
   The first index that has a lagging window is 3. For index equals 3, the lagging window has sequence '123',
   the chunk to leave lagging window(lw_leave_chunk) is '12', and the chunk to enter lagging window(lw_enter_chunk) is '34'.
   Therefore, given chunk dicts at i, to compute chunk dicts at i+1, simply decrement the count for lw_leave_chunk,
   and increment the count for lw_enter_chunk from chunk dicts at i. Same method applies to future window as well.
docstr_tok: ["Construct","the","chunk","dicts","for","lagging","window","and","future","window","at","each","index",".","e.g",":","Suppose","we","have","a","SAX","sequence","as","'1234567890","'",",","both","window","sizes","are","3",",","and","the","chunk","size","is","2",".","The","first","index","that","has","a","lagging","window","is","3",".","For","index","equals","3",",","the","lagging","window","has","sequence","'123","'",",","the","chunk","to","leave","lagging","window","(","lw_leave_chunk",")","is","'12","'",",","and","the","chunk","to","enter","lagging","window","(","lw_enter_chunk",")","is","'34","'",".","Therefore",",","given","chunk","dicts","at","i",",","to","compute","chunk","dicts","at","i+1",",","simply","decrement","the","count","for","lw_leave_chunk",",","and","increment","the","count","for","lw_enter_chunk","from","chunk","dicts","at","i",".","Same","method","applies","to","future","window","as","well","."]
code: def _construct_all_SAX_chunk_dict(self):
      """
      Construct the chunk dicts for lagging window and future window at each index.
       e.g: Suppose we have a SAX sequence as '1234567890', both window sizes are 3, and the chunk size is 2.
       The first index that has a lagging window is 3. For index equals 3, the lagging window has sequence '123',
       the chunk to leave lagging window(lw_leave_chunk) is '12', and the chunk to enter lagging window(lw_enter_chunk) is '34'.
       Therefore, given chunk dicts at i, to compute chunk dicts at i+1, simply decrement the count for lw_leave_chunk,
       and increment the count for lw_enter_chunk from chunk dicts at i. Same method applies to future window as well.
      """
      lag_dicts = {}
      fut_dicts = {}
      length = self.time_series_length
      lws = self.lag_window_size
      fws = self.future_window_size
      chunk_size = self.chunk_size
  
      for i in range(length):
          # If i is too small or too big, there will be no chunk dicts.
          if i < lws or i > length - fws:
              lag_dicts[i] = None
  
          else:
              # Just enter valid range.
              if lag_dicts[i - 1] is None:
                  lag_dict = self._construct_SAX_chunk_dict(
                      self.sax[i - lws : i]
                  )
                  lag_dicts[i] = lag_dict
                  lw_leave_chunk = self.sax[0:chunk_size]
                  lw_enter_chunk = self.sax[i - chunk_size + 1 : i + 1]
  
                  fut_dict = self._construct_SAX_chunk_dict(
                      self.sax[i : i + fws]
                  )
                  fut_dicts[i] = fut_dict
                  fw_leave_chunk = self.sax[i : i + chunk_size]
                  fw_enter_chunk = self.sax[
                      i + fws + 1 - chunk_size : i + fws + 1
                  ]
  
              else:
                  # Update dicts according to leave_chunks and enter_chunks.
                  lag_dict = copy(lag_dicts[i - 1])
                  lag_dict[lw_leave_chunk] -= 1
                  lag_dict[lw_enter_chunk] += 1
                  lag_dicts[i] = lag_dict
  
                  fut_dict = copy(fut_dicts[i - 1])
                  fut_dict[fw_leave_chunk] -= 1
                  fut_dict[fw_enter_chunk] += 1
                  fut_dicts[i] = fut_dict
  
                  # Updata leave_chunks and enter_chunks.
                  lw_leave_chunk = self.sax[
                      i - lws : i - lws + chunk_size
                  ]
                  lw_enter_chunk = self.sax[i - chunk_size + 1 : i + 1]
                  fw_leave_chunk = self.sax[i : i + chunk_size]
                  fw_enter_chunk = self.sax[
                      i + fws + 1 - chunk_size : i + fws + 1
                  ]
  
      self.lag_dicts = lag_dicts
      self.fut_dicts = fut_dicts
  
file_path: luminol/src/luminol/algorithms/anomaly_detector_algorithms/bitmap_detector.py
imports: from collections import defaultdict
  from copy import copy
  import math
  from luminol import exceptions
  from luminol.algorithms.anomaly_detector_algorithms import AnomalyDetectorAlgorithm
  from luminol.modules.time_series import TimeSeries
  from luminol.constants import DEFAULT_BITMAP_PRECISION, DEFAULT_BITMAP_CHUNK_SIZE, DEFAULT_BITMAP_LAGGING_WINDOW_SIZE_PCT, DEFAULT_BITMAP_LEADING_WINDOW_SIZE_PCT, DEFAULT_BITMAP_MINIMAL_POINTS_IN_WINDOWS, DEFAULT_BITMAP_MAXIMAL_POINTS_IN_WINDOWS
label_desc: Use image node_id 6 for calling the BitmapDetector obj's underlying member method code with example usage: obj._construct_all_SAX_chunk_dict() without return types