Skip to content
Merged
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
10 changes: 9 additions & 1 deletion sdgym/synthesizers/uniform.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""UniformSynthesizer module."""

import logging
import warnings

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -32,7 +33,14 @@ def _get_trained_synthesizer(self, real_data, metadata):
f'defaulting to inferred type.'
)

hyper_transformer.update_sdtypes(config)
with warnings.catch_warnings():
warnings.filterwarnings(
'ignore',
message='.*is incompatible with transformer.*',
category=UserWarning,
)
hyper_transformer.update_sdtypes(config)

# This is done to match the behavior of the synthesizer for SDGym <= 0.6.0
columns_to_remove = [
column_name
Expand Down
29 changes: 29 additions & 0 deletions tests/unit/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,3 +894,32 @@ def test__add_adjusted_scores_missing_fallback():

# Assert
assert scores.equals(expected)


def test_benchmark_single_table_no_warning_uniform_synthesizer(recwarn):
"""Test that no UserWarning is raised when running `UniformSynthesizer`."""
# Setup
expected_result = pd.DataFrame({
'Synthesizer': {0: 'UniformSynthesizer'},
'Dataset': {0: 'fake_hotel_guests'},
})

# Run
result = benchmark_single_table(
synthesizers=['UniformSynthesizer'],
custom_synthesizers=None,
sdv_datasets=['fake_hotel_guests'],
additional_datasets_folder=None,
limit_dataset_size=False,
timeout=None,
show_progress=False,
compute_diagnostic_score=True,
compute_quality_score=True,
compute_privacy_score=False,
sdmetrics=None,
)

# Assert
warnings_text = ' '.join(str(w.message) for w in recwarn)
assert 'is incompatible with transformer' not in warnings_text
pd.testing.assert_frame_equal(result[expected_result.columns], expected_result)
Loading