Skip to content

Commit

Permalink
Output sparse ternary differently.
Browse files Browse the repository at this point in the history
  • Loading branch information
ludopulles committed Oct 29, 2024
1 parent cbee849 commit 9ef4365
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions estimator/nd.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,23 @@ def support_size(self, fraction=1.0):
n, p, m = len(self), self.p, self.m
return ceil(binomial(n, p) * binomial(n - p, m) * RR(fraction))

def __str__(self):
"""
EXAMPLE::
>>> from estimator import *
>>> ND.SparseTernary(20, 20, n=100)
T(p=20, m=20, n=100)
"""
if self.n:
return f"T(p={self.p}, m={self.m}, n={int(self.n)})"
else:
return f"T(p={int(self.p)}, m={int(self.m)})"

def __repr__(self):
return str(self)


def SparseBinary(hw, n=None):
"""
Expand Down

0 comments on commit 9ef4365

Please sign in to comment.