(self)
| 677 | @dataclass |
| 678 | class JLSampler(Sampler): |
| 679 | weights: torch.Tensor # [V, D] |
| 680 | k: int |
| 681 | prepared: bool = False |
| 682 | |
| 683 | @classmethod |
| 684 | def from_weights( |
| 685 | cls, |
| 686 | weights: torch.Tensor, # [V, D] |
| 687 | epsilon: float = 0.2, |
| 688 | ) -> "JLSampler": |
| 689 | k = optimal_k(n=weights.shape[0], epsilon=epsilon) |
| 690 | print(f"JLSampler optimal k={k}") |
| 691 | return cls(weights, k=k) |
| 692 | |
| 693 | def prepare(self) -> "JLSampler": |
nothing calls this directly
no outgoing calls
no test coverage detected