-
Notifications
You must be signed in to change notification settings - Fork 67
Add multi table support to ResultsExplorer #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fealho
merged 8 commits into
feature_branch/mutli_table_benchmark
from
issue-488-multi-table-result-explorer
Dec 8, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a7f071e
Update handler
fealho bf8c3e9
Add changes
fealho 1f75f2e
Feedback
fealho 6f7a9f5
Feedback
fealho 89f4dbf
Fix lint
fealho cf10b04
Validate modality
fealho 392f8b1
Fix tests
fealho 3a78dba
Feedback
fealho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,14 @@ | |
|
|
||
| import os | ||
|
|
||
| from sdgym.benchmark import DEFAULT_SINGLE_TABLE_DATASETS | ||
| from sdgym.datasets import load_dataset | ||
| from sdgym.result_explorer.result_handler import LocalResultsHandler, S3ResultsHandler | ||
| from sdgym.result_explorer.result_handler import ( | ||
| SYNTHESIZER_BASELINE, | ||
| LocalResultsHandler, | ||
| S3ResultsHandler, | ||
| ) | ||
| from sdgym.s3 import _get_s3_client, is_s3_path | ||
| from sdgym.synthesizers.base import _validate_modality | ||
|
|
||
|
|
||
| def _validate_local_path(path): | ||
|
|
@@ -14,20 +18,51 @@ def _validate_local_path(path): | |
| raise ValueError(f"The provided path '{path}' is not a valid local directory.") | ||
|
|
||
|
|
||
| _BASELINE_BY_MODALITY = { | ||
fealho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 'single_table': SYNTHESIZER_BASELINE, | ||
| 'multi_table': 'MultiTableUniformSynthesizer', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fealho can you ask in the Team-Engineering channel which synthesizer we should use as the baseline for multi-table here? Just to make sure everything is as expected. With this implementation it will be easy to update it in the future 👍 |
||
| } | ||
|
|
||
|
|
||
| def _resolve_effective_path(path, modality): | ||
| """Append the modality folder to the given base path if provided.""" | ||
| # Avoid double-appending if already included | ||
| if str(path).rstrip('/').endswith(('/' + modality, modality)): | ||
| return path | ||
|
|
||
| if is_s3_path(path): | ||
| return path.rstrip('/') + '/' + modality | ||
|
|
||
| return os.path.join(path, modality) | ||
|
|
||
|
|
||
| class ResultsExplorer: | ||
| """Explorer for SDGym benchmark results, supporting both local and S3 storage.""" | ||
|
|
||
| def __init__(self, path, aws_access_key_id=None, aws_secret_access_key=None): | ||
| def _create_results_handler(self, original_path, effective_path): | ||
| """Create the appropriate results handler for local or S3 storage.""" | ||
| baseline_synthesizer = _BASELINE_BY_MODALITY.get(self.modality, SYNTHESIZER_BASELINE) | ||
| if is_s3_path(original_path): | ||
| s3_client = _get_s3_client( | ||
| original_path, self.aws_access_key_id, self.aws_secret_access_key | ||
| ) | ||
| return S3ResultsHandler( | ||
| effective_path, s3_client, baseline_synthesizer=baseline_synthesizer | ||
| ) | ||
|
|
||
| _validate_local_path(effective_path) | ||
| return LocalResultsHandler(effective_path, baseline_synthesizer=baseline_synthesizer) | ||
|
|
||
| def __init__( | ||
| self, path, modality='single_table', aws_access_key_id=None, aws_secret_access_key=None | ||
| ): | ||
| self.path = path | ||
| _validate_modality(modality) | ||
| self.modality = modality.lower() | ||
| self.aws_access_key_id = aws_access_key_id | ||
| self.aws_secret_access_key = aws_secret_access_key | ||
|
|
||
| if is_s3_path(path): | ||
| s3_client = _get_s3_client(path, aws_access_key_id, aws_secret_access_key) | ||
| self._handler = S3ResultsHandler(path, s3_client) | ||
| else: | ||
| _validate_local_path(path) | ||
| self._handler = LocalResultsHandler(path) | ||
| effective_path = _resolve_effective_path(path, self.modality) | ||
| self._handler = self._create_results_handler(path, effective_path) | ||
|
|
||
| def list(self): | ||
| """List all runs available in the results directory.""" | ||
|
|
@@ -37,7 +72,11 @@ def _get_file_path(self, results_folder_name, dataset_name, synthesizer_name, fi | |
| """Validate access to the synthesizer or synthetic data file.""" | ||
| end_filename = f'{synthesizer_name}' | ||
| if file_type == 'synthetic_data': | ||
| end_filename += '_synthetic_data.csv' | ||
| # Multi-table synthetic data is zipped (multiple CSVs), single table is CSV | ||
| if self.modality == 'multi_table': | ||
| end_filename += '_synthetic_data.zip' | ||
| else: | ||
| end_filename += '_synthetic_data.csv' | ||
| elif file_type == 'synthesizer': | ||
| end_filename += '.pkl' | ||
|
|
||
|
|
@@ -62,14 +101,8 @@ def load_synthetic_data(self, results_folder_name, dataset_name, synthesizer_nam | |
|
|
||
| def load_real_data(self, dataset_name): | ||
| """Load the real data for a given dataset.""" | ||
| if dataset_name not in DEFAULT_SINGLE_TABLE_DATASETS: | ||
| raise ValueError( | ||
| f"Dataset '{dataset_name}' is not a SDGym dataset. " | ||
| 'Please provide a valid dataset name.' | ||
| ) | ||
|
|
||
| data, _ = load_dataset( | ||
| modality='single_table', | ||
| modality=self.modality, | ||
| dataset=dataset_name, | ||
| aws_access_key_id=self.aws_access_key_id, | ||
| aws_secret_access_key=self.aws_secret_access_key, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+988 KB
...i_table/SDGym_results_12_02_2025/fake_hotels_12_02_2025/HMASynthesizer/HMASynthesizer.pkl
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
...ults_12_02_2025/fake_hotels_12_02_2025/HMASynthesizer/HMASynthesizer_benchmark_result.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Synthesizer,Dataset,Dataset_Size_MB,Train_Time,Peak_Memory_MB,Synthesizer_Size_MB,Sample_Time,Evaluate_Time,Diagnostic_Score,Quality_Score | ||
| HMASynthesizer,fake_hotels,0.048698,22.852492,33.315142,0.988611,2.723049,0.082362,1.0,0.7353482911012336 |
Binary file added
BIN
+34.6 KB
...esults_12_02_2025/fake_hotels_12_02_2025/HMASynthesizer/HMASynthesizer_synthetic_data.zip
Binary file not shown.
Binary file added
BIN
+107 KB
...2025/fake_hotels_12_02_2025/MultiTableUniformSynthesizer/MultiTableUniformSynthesizer.pkl
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
...12_02_2025/MultiTableUniformSynthesizer/MultiTableUniformSynthesizer_benchmark_result.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Synthesizer,Dataset,Dataset_Size_MB,Train_Time,Peak_Memory_MB,Synthesizer_Size_MB,Sample_Time,Evaluate_Time,Diagnostic_Score,Quality_Score | ||
| MultiTableUniformSynthesizer,fake_hotels,0.048698,0.201284,0.851853,0.109464,0.02749,0.081629,0.9122678149273894,0.5962941240006595 |
Binary file added
BIN
+43.1 KB
...s_12_02_2025/MultiTableUniformSynthesizer/MultiTableUniformSynthesizer_synthetic_data.zip
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
...ion/result_explorer/_benchmark_results/multi_table/SDGym_results_12_02_2025/metainfo.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| completed_date: 12_02_2025 08:28:47 | ||
| jobs: | ||
| - - fake_hotels | ||
| - MultiTableUniformSynthesizer | ||
| - - fake_hotels | ||
| - HMASynthesizer | ||
| modality: multi_table | ||
| run_id: run_12_02_2025_0 | ||
| sdgym_version: 0.11.2.dev0 | ||
| sdv_version: 1.28.0 | ||
| starting_date: 12_02_2025 08:28:21 |
3 changes: 3 additions & 0 deletions
3
...ation/result_explorer/_benchmark_results/multi_table/SDGym_results_12_02_2025/results.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Synthesizer,Dataset,Dataset_Size_MB,Train_Time,Peak_Memory_MB,Synthesizer_Size_MB,Sample_Time,Evaluate_Time,Diagnostic_Score,Quality_Score,Adjusted_Total_Time,Adjusted_Quality_Score | ||
| MultiTableUniformSynthesizer,fake_hotels,0.048698,0.201284,0.851853,0.109464,0.02749,0.081629,0.9122678149273894,0.5962941240006595,0.430058,0.5962941240006595 | ||
| HMASynthesizer,fake_hotels,0.048698,22.852492,33.315142,0.988611,2.723049,0.082362,1.0,0.7353482911012336,25.776825000000002,0.7353482911012336 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.