Exemplo n.º 1
0
 def __init__(
     self,
     variance: VarianceTracker = None,
     floats: FloatTracker = None,
     ints: IntTracker = None,
     theta_sketch: ThetaSketch = None,
     histogram: datasketches.kll_floats_sketch = None,
     frequent_numbers: dsketch.FrequentNumbersSketch = None,
 ):
     # Our own trackers
     if variance is None:
         variance = VarianceTracker()
     if floats is None:
         floats = FloatTracker()
     if ints is None:
         ints = IntTracker()
     if theta_sketch is None:
         theta_sketch = ThetaSketch()
     if histogram is None:
         histogram = datasketches.kll_floats_sketch(DEFAULT_HIST_K)
     if frequent_numbers is None:
         frequent_numbers = dsketch.FrequentNumbersSketch()
     self.variance = variance
     self.floats = floats
     self.ints = ints
     self.theta_sketch = theta_sketch
     self.histogram = histogram
     self.frequent_numbers = frequent_numbers
Exemplo n.º 2
0
    def __init__(
        self,
        count: int = None,
        items: frequent_strings_sketch = None,
        theta_sketch: ThetaSketch = None,
        length: NumberTracker = None,
        token_length: NumberTracker = None,
        char_pos_tracker: CharPosTracker = None,
        token_method: Callable[[], List[str]] = None,
    ):
        if count is None:
            count = 0
        if items is None:
            items = frequent_strings_sketch(round(math.log(MAX_ITEMS_SIZE)))
        if theta_sketch is None:
            theta_sketch = ThetaSketch()
        self.count = count
        self.items = items
        self.theta_sketch = theta_sketch

        self.char_pos_tracker = char_pos_tracker if char_pos_tracker else CharPosTracker(
        )

        self.length = length if length else NumberTracker()

        self.token_length = token_length if token_length else NumberTracker()

        self.token_method = token_method if token_method else lambda x: x.split(
            " ")
Exemplo n.º 3
0
 def __init__(
     self,
     count: int = None,
     items: frequent_strings_sketch = None,
     theta_sketch: ThetaSketch = None,
 ):
     if count is None:
         count = 0
     if items is None:
         items = frequent_strings_sketch(round(math.log(MAX_ITEMS_SIZE)))
     if theta_sketch is None:
         theta_sketch = ThetaSketch()
     self.count = count
     self.items = items
     self.theta_sketch = theta_sketch