You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for sharing the code. When creating a custom synthesizer in SDGym, it is important to store the intermediate results. However, the generated result file cannot be opened. And I can not find the code to generate the file, what should I do?
Steps to reproduce
importosimportshutilimportsdgymfromsdgymimportcreate_single_table_synthesizerfromsdgym.synthesizersimport (UniformSynthesizer,
GaussianCopulaSynthesizer,
TVAESynthesizer)
importwarningswarnings.filterwarnings('ignore')
synthesizers= [
UniformSynthesizer,
GaussianCopulaSynthesizer,
TVAESynthesizer
]
# YData# CTGANdefctgan_get_trained_synthesizer(data, metadata):
fromydata_synthetic.synthesizers.regularimportRegularSynthesizerfromydata_synthetic.synthesizersimportModelParameters, TrainParametersctgan_args=ModelParameters(batch_size=500, lr=2e-4, betas=(0.5, 0.9))
train_args=TrainParameters(epochs=2)
synthesizer=RegularSynthesizer(modelname='ctgan', model_parameters=ctgan_args)
num_cols= [colforcol, sdtypeinmetadata['columns'].items() ifsdtype['sdtype'] in ['numerical', 'datetime']]
cat_cols= [colforcol, sdtypeinmetadata['columns'].items() ifsdtype['sdtype'] =='categorical']
synthesizer.fit(data=data,
train_arguments=train_args,
num_cols=num_cols,
cat_cols=cat_cols)
returnsynthesizerdefsample_from_synthesizer(synthesizer, n_rows):
synthetic_data=synthesizer.sample(n_rows)
returnsynthetic_dataYData_CTGANSynthesizer=create_single_table_synthesizer(
get_trained_synthesizer_fn=ctgan_get_trained_synthesizer,
sample_from_synthesizer_fn=sample_from_synthesizer,
display_name='YData-CTGAN'
)
custom_synthesizers= [YData_CTGANSynthesizer]
# Detect the existence of the folderdetailed_results_folder=r"C:\Users\18840\Desktop\result"ifos.path.isdir(detailed_results_folder) and\
os.path.exists(detailed_results_folder):
print('The folder where the intermediate files are stored already exists and is processed for deletion.')
shutil.rmtree(detailed_results_folder, ignore_errors=True)
print('-'*50)
results=sdgym.benchmark_single_table(
synthesizers=synthesizers,
custom_synthesizers=custom_synthesizers,
show_progress=True,
multi_processing_config={
'package_name': 'multiprocessing',
'num_workers': 8
},
sdv_datasets=['adult'],
detailed_results_folder=detailed_results_folder
)
Here is an example of the output files.
The text was updated successfully, but these errors were encountered:
Environment Details
Error Description
Thank you for sharing the code. When creating a custom synthesizer in SDGym, it is important to store the intermediate results. However, the generated result file cannot be opened. And I can not find the code to generate the file, what should I do?
Steps to reproduce
Here is an example of the output files.
The text was updated successfully, but these errors were encountered: