Skip to content

Commit c3a7a37

Browse files
authored
Merge pull request #23 from kevinykuo/bugfix/flaky-test
Fix flaky test associated w/ sampling
2 parents ac87f05 + 038662c commit c3a7a37

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

tests/integration/test_ctgan.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,24 @@ def test_ctgan_numpy():
5151

5252

5353
def test_log_frequency():
54+
5455
data = pd.DataFrame({
5556
'continuous': np.random.random(1000),
56-
'discrete': np.random.choice(['a', 'b', 'c'], 1000, p=[0.95, 0.025, 0.025])
57+
'discrete': np.repeat(['a', 'b', 'c'], [950, 25, 25])
5758
})
5859

5960
discrete_columns = ['discrete']
6061

6162
ctgan = CTGANSynthesizer()
6263
ctgan.fit(data, discrete_columns, epochs=100)
6364

64-
sampled = ctgan.sample(1000)
65+
sampled = ctgan.sample(10000)
6566
counts = sampled['discrete'].value_counts()
66-
assert counts['a'] < 650
67+
assert counts['a'] < 6500
6768

6869
ctgan = CTGANSynthesizer()
6970
ctgan.fit(data, discrete_columns, epochs=100, log_frequency=False)
7071

71-
sampled = ctgan.sample(1000)
72+
sampled = ctgan.sample(10000)
7273
counts = sampled['discrete'].value_counts()
73-
assert counts['a'] > 900
74+
assert counts['a'] > 9000

0 commit comments

Comments
 (0)