Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dpsynth/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@

PathType = pathlib.Path

CategoricalValue: TypeAlias = bool | int | str
CategoricalValue: TypeAlias = bool | int | float | str


IntervalHandling = Literal['midpoint', 'sample', 'interval']

Expand Down
8 changes: 5 additions & 3 deletions dpsynth/local_mode/vectorized_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def undiscretize(
``attribute_domain.resolved_sentinel``.
"""
rng = np.random.default_rng(rng)
min_, max_ = attribute_domain.min_value, attribute_domain.max_value
min_, max_ = attribute_domain.exclusive_min_value, attribute_domain.max_value
_validate_bin_edges(bin_edges, attribute_domain)

if bin_edges.size == 0:
Expand All @@ -195,8 +195,10 @@ def undiscretize(
sentinel = attribute_domain.resolved_sentinel

if handling == 'interval':
# First interval is closed on both sides; the rest are half-open.
strs = [f'[{lefts[0]}, {rights[0]}]'] + [
# First interval is closed on both sides (display uses min_value for
# readability); the rest are half-open (left, right].
display_min = attribute_domain.min_value
strs = [f'[{display_min}, {rights[0]}]'] + [
f'({l}, {r}]' for l, r in zip(lefts[1:], rights[1:])
]
values = np.array(strs, dtype=str)
Expand Down
343 changes: 0 additions & 343 deletions dpsynth/text/bulk_inference.py

This file was deleted.

4 changes: 2 additions & 2 deletions dpsynth/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def create_discretize_transformation(
)

bin_edges = np.r_[
attribute_domain.min_value,
attribute_domain.exclusive_min_value,
bin_edges,
attribute_domain.max_value,
]
Expand Down Expand Up @@ -266,7 +266,7 @@ def create_uniform_discretize_transformation(
interval in the CategoricalAttribute and vice versa.
"""
bin_edges = np.linspace(
attribute_domain.min_value,
attribute_domain.exclusive_min_value,
attribute_domain.max_value,
num_bins + 1,
)
Expand Down
Loading
Loading