class TestPytorchDPSynthesizer_PATECTGAN: def setup(self): self.patectgan = PytorchDPSynthesizer(1.0, PATECTGAN(), None) def test_fit(self): self.patectgan.fit( df_non_continuous, categorical_columns=['sex', 'educ', 'race', 'married']) assert self.patectgan.gan._generator def test_sample(self): self.patectgan.fit( df_non_continuous, categorical_columns=['sex', 'educ', 'race', 'married']) sample_size = len(df) synth_data = self.patectgan.sample(sample_size) assert synth_data.shape == df_non_continuous.shape
class TestDPGAN: def setup(self): self.pategan = PytorchDPSynthesizer(1.0, PATEGAN(1.0), GeneralTransformer()) def test_fit(self): df_non_continuous = df[['sex', 'educ', 'race', 'married']] self.pategan.fit( df_non_continuous, categorical_columns=['sex', 'educ', 'race', 'married']) assert self.pategan.gan.generator def test_sample(self): df_non_continuous = df[['sex', 'educ', 'race', 'married']] self.pategan.fit( df_non_continuous, categorical_columns=['sex', 'educ', 'race', 'married']) sample_size = len(df_non_continuous) synth_data = self.pategan.sample(sample_size) assert synth_data.shape == df_non_continuous.shape
class TestPytorchDPSynthesizer_DPCTGAN: def setup(self): self.dpctgan = PytorchDPSynthesizer(1.0, DPCTGAN(), None) def test_fit(self): df_non_continuous = df[['sex', 'educ', 'race', 'married']] self.dpctgan.fit( df_non_continuous, categorical_columns=['sex', 'educ', 'race', 'married']) assert self.dpctgan.gan._generator def test_sample(self): self.dpctgan.fit( df_non_continuous, categorical_columns=['sex', 'educ', 'race', 'married']) sample_size = len(df) synth_data = self.dpctgan.sample(sample_size) assert synth_data.shape == df_non_continuous.shape def test_fit_numpy(self): dpctgan = DPCTGAN(epsilon=1.0) dpctgan.train(nf_non_continuous, categorical_columns=[0, 1, 2, 3])
class TestPytorchDPSynthesizer_DPGAN: def setup(self): self.dpgan = PytorchDPSynthesizer(1.0, DPGAN(), GeneralTransformer()) def test_fit(self): self.dpgan.fit(df_non_continuous, categorical_columns=['sex', 'educ', 'race', 'married']) assert self.dpgan.gan.generator def test_sample(self): self.dpgan.fit(df_non_continuous, categorical_columns=['sex', 'educ', 'race', 'married']) sample_size = len(df_non_continuous) synth_data = self.dpgan.sample(sample_size) assert synth_data.shape == df_non_continuous.shape def test_fit_continuous(self): dpgan = DPGAN(epsilon=1.0) df_continuous = df[['age', 'educ', 'income']] dpgan.train(df_continuous) synth_data = dpgan.generate(len(df_continuous)) assert synth_data.shape == df_continuous.shape