(self, quantile)
return self.sampled[-1].value
Given the queried quantile, return the approximation guaranteed result
        Parameters
        ----------
        quantile : float [0.0, 1.0]
            The target quantile

        Returns
        -------
        float, the corresponding value result.
Given the queried quantile, return the approximation guaranteed result
        Parameters
        ----------
        quantile : float [0.0, 1.0]
            The target quantile
Given the queried quantile return the approximation guaranteed result Parameters ---------- quantile : float [ 0 . 0 1 . 0 ] The target quantile
def query(self, quantile):
        """
        Given the queried quantile, return the approximation guaranteed result
        Parameters
        ----------
        quantile : float [0.0, 1.0]
            The target quantile

        Returns
        -------
        float, the corresponding value result.
        """
        if self.head_sampled:
            # self._insert_head_buffer()
            self.compress()

        if quantile < 0 or quantile > 1:
            raise ValueError("Quantile should be in range [0.0, 1.0]")

        if self.count == 0:
            return 0

        if quantile <= self.error:
            return self.sampled[0].value

        if quantile >= 1 - self.error:
            return self.sampled[-1].value

        rank = math.ceil(quantile * self.count)
        target_error = math.ceil(self.error * self.count)
        min_rank = 0
        i = 1
        while i < len(self.sampled) - 1:
            cur_sample = self.sampled[i]
            min_rank += cur_sample.g
            max_rank = min_rank + cur_sample.delta
            if max_rank - target_error <= rank <= min_rank + target_error:
                return cur_sample.value
            i += 1
        return self.sampled[-1].value
def query ( self , quantile ) : if self . head_sampled : # self._insert_head_buffer() self . compress ( ) if quantile < 0 or quantile > 1 : raise ValueError ( "Quantile should be in range [0.0, 1.0]" ) if self . count == 0 : return 0 if quantile <= self . error : return self . sampled [ 0 ] . value if quantile >= 1 - self . error : return self . sampled [ - 1 ] . value rank = math . ceil ( quantile * self . count ) target_error = math . ceil ( self . error * self . count ) min_rank = 0 i = 1 while i < len ( self . sampled ) - 1 : cur_sample = self . sampled [ i ] min_rank += cur_sample . g max_rank = min_rank + cur_sample . delta if max_rank - target_error <= rank <= min_rank + target_error : return cur_sample . value i += 1 return self . sampled [ - 1 ] . value