Source: https://cs.stanford.edu/people/mmahoney/cs369m/Lectures/lecture1.pdf
(n: int, epsilon: float)
| 722 | |
| 723 | |
| 724 | def optimal_k(n: int, epsilon: float) -> int: |
| 725 | """Source: https://cs.stanford.edu/people/mmahoney/cs369m/Lectures/lecture1.pdf""" |
| 726 | k_float = 24 * math.log(n, math.e) / (3 * epsilon**2 - 2 * epsilon**3) |
| 727 | return int(math.ceil(k_float)) |
| 728 | |
| 729 | |
| 730 | def get_sampler(provider: str, weights: torch.Tensor) -> Sampler: |