Skip to content

Commit

Permalink
Handle integer epsilon (#579)
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua <joshua-oss@users.noreply.github.com>
  • Loading branch information
joshua-oss and joshua-oss authored Nov 4, 2023
1 parent 552ec86 commit 7db904c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions synth/snsynth/aim/aim.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class AIMSynthesizer(Synthesizer):

def __init__(self, epsilon=1., delta=1e-9, max_model_size=80, degree=2, num_marginals=None, max_cells: int = 10000,
rounds=None, verbose=False):
if isinstance(epsilon, int):
epsilon = float(epsilon)
self.rounds = rounds
self.max_model_size = max_model_size
self.max_cells = max_cells
Expand Down
2 changes: 2 additions & 0 deletions synth/snsynth/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ def create(cls, synth=None, epsilon=None, *args, **kwargs):
:type kwargs: dict, optional
"""
if isinstance(epsilon, int):
epsilon = float(epsilon)
if synth is None or (isinstance(synth, type) and issubclass(synth, Synthesizer)):
clsname = cls.__module__ + '.' + cls.__name__ if synth is None else synth.__module__ + '.' + synth.__name__
if clsname == 'snsynth.base.Synthesizer':
Expand Down
3 changes: 2 additions & 1 deletion synth/snsynth/mst/mst.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def __init__(self,
*ignore,
verbose=False
):

if isinstance(epsilon, int):
epsilon = float(epsilon)
self.epsilon = epsilon
self.delta = delta
self.verbose = verbose
Expand Down
2 changes: 2 additions & 0 deletions synth/snsynth/mwem.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ def __init__(
mult_weights_iterations=20,
verbose=False
):
if isinstance(epsilon, int):
epsilon = float(epsilon)
self.epsilon = epsilon
self.q_count = q_count
self.iterations = iterations
Expand Down

0 comments on commit 7db904c

Please sign in to comment.