class_docstr: Largest Triangle Three Buckets (LTTB) aggregation method.
  
  This is arguably the most widely used aggregation method. It is based on the
  effective area of a triangle (inspired from the line simplification domain).
  The algorithm has $O(n)$ complexity, however, for large datasets, it can be much
  slower than other algorithms (e.g. MinMax) due to the higher cost of calculating
  the areas of triangles.
  
  Thesis: [https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf](https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf) <br/>
  Details on visual representativeness & stability: [https://arxiv.org/abs/2304.00900](https://arxiv.org/abs/2304.00900)
  
  !!! tip
  
      `LTTB` doesn't scale super-well when moving to really large datasets, so when
      dealing with more than 1 million samples, you might consider using
      [`MinMaxLTTB`][aggregation.aggregators.MinMaxLTTB].
  
  
  !!! note
  
      * This class is mainly designed to operate on numerical data as LTTB calculates
        distances on the values. <br/>
        When dealing with categories, the data is encoded into its numeric codes,
        these codes are the indices of the category array.
      * To aggregate category data with LTTB, your ``pd.Series`` must be of dtype
        'category'. <br/>
  
        **tip**:
  
        if there is an order in your categories, order them that way, LTTB uses
        the ordered category codes values (see bullet above) to calculate distances and
        make aggregation decisions. <br/>
        **code**:
          ```python
              >>> import pandas as pd
              >>> s = pd.Series(["a", "b", "c", "a"])
              >>> cat_type = pd.CategoricalDtype(categories=["b", "c", "a"], ordered=True)
              >>> s_cat = s.astype(cat_type)
          ```
      * `LTTB` has no downsample kwargs, as it cannot be paralellized. Instead, you can
        use the [`MinMaxLTTB`][aggregation.aggregators.MinMaxLTTB] downsampler, which performs
        minmax preselection (in parallel if configured so), followed by LTTB.
class_docstr_tok: ["Largest","Triangle","Three","Buckets","(","LTTB",")","aggregation","method",".","This","is","arguably","the","most","widely","used","aggregation","method",".","It","is","based","on","the","effective","area","of","a","triangle","(","inspired","from","the","line","simplification","domain",")",".","The","algorithm","has","$","O","(","n",")","$","complexity",",","however",",","for","large","datasets",",","it","can","be","much","slower","than","other","algorithms","(","e.g",".","MinMax",")","due","to","the","higher","cost","of","calculating","the","areas","of","triangles",".","Thesis",":","[","https",":","\/\/skemman.is\/bitstream\/1946\/15343\/3\/SS_MSthesis.pdf","]","(","https",":","\/\/skemman.is\/bitstream\/1946\/15343\/3\/SS_MSthesis.pdf",")","<","br\/",">","Details","on","visual","representativeness","&","stability",":","[","https",":","\/\/arxiv.org\/abs\/2304.00900","]","(","https",":","\/\/arxiv.org\/abs\/2304.00900",")","!","!","!","tip","`","LTTB","`","does","n't","scale","super-well","when","moving","to","really","large","datasets",",","so","when","dealing","with","more","than","1","million","samples",",","you","might","consider","using","[","`","MinMaxLTTB","`","]","[","aggregation.aggregators.MinMaxLTTB","]",".","!","!","!","note","*","This","class","is","mainly","designed","to","operate","on","numerical","data","as","LTTB","calculates","distances","on","the","values",".","<","br\/",">","When","dealing","with","categories",",","the","data","is","encoded","into","its","numeric","codes",",","these","codes","are","the","indices","of","the","category","array",".","*","To","aggregate","category","data","with","LTTB",",","your","``","pd.Series","``","must","be","of","dtype","'category","'",".","<","br\/",">","*","*","tip","*","*",":","if","there","is","an","order","in","your","categories",",","order","them","that","way",",","LTTB","uses","the","ordered","category","codes","values","(","see","bullet","above",")","to","calculate","distances","and","make","aggregation","decisions",".","<","br\/",">","*","*","code","*","*",":","``","`","python",">",">",">","import","pandas","as","pd",">",">",">","s","=","pd.Series","(","[","``","a","''",",","``","b","''",",","``","c","''",",","``","a","''","]",")",">",">",">","cat_type","=","pd.CategoricalDtype","(","categories=","[","``","b","''",",","``","c","''",",","``","a","''","]",",","ordered=True",")",">",">",">","s_cat","=","s.astype","(","cat_type",")","``","`","*","`","LTTB","`","has","no","downsample","kwargs",",","as","it","can","not","be","paralellized",".","Instead",",","you","can","use","the","[","`","MinMaxLTTB","`","]","[","aggregation.aggregators.MinMaxLTTB","]","downsampler",",","which","performs","minmax","preselection","(","in","parallel","if","configured","so",")",",","followed","by","LTTB","."]
code: def _arg_downsample(
      self,
      x: np.ndarray | None,
      y: np.ndarray,
      n_out: int,
  ) -> np.ndarray:
      return self.downsampler.downsample(
          *_to_tsdownsample_args(x, y), n_out=n_out
      )
  
imports: from __future__ import annotations
  import math
  from typing import Tuple
  import numpy
  from tsdownsample import EveryNthDownsampler, LTTBDownsampler, MinMaxDownsampler, MinMaxLTTBDownsampler
  from ..aggregation.aggregation_interface import DataAggregator, DataPointSelector
label_desc: Use image node_id 2 for calling the LTTB obj's underlying member method code with example usage: obj._arg_downsample(x, y, n_out) and returns: self