Skip to content
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

PATECTGAN performs poorly on categorical #489

Open
joshua-oss opened this issue Oct 6, 2022 · 0 comments
Open

PATECTGAN performs poorly on categorical #489

joshua-oss opened this issue Oct 6, 2022 · 0 comments

Comments

@joshua-oss
Copy link
Contributor

joshua-oss commented Oct 6, 2022

patectgan
PATECTGAN performs poorly with categorical values, and seems to have been broken since at least 0.2.1. Continuous values work OK in PATECTGAN, and categorical and continuous both work OK with DPCTGAN, so this doesn't appear to be a bug in the conditional vector sampler.

repro code:

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from snsynth.pytorch.nn import PATECTGAN

size = 10000
eps = 3.0

# Two columns with 5 categories each, all mass is on diagonal
np_data_xy = (
    np.array([np.arange(0, size) % 5, (np.arange(0, size) % 5) * 10]).astype(np.int16).T
)
df = pd.DataFrame(np_data_xy, columns=["x", "y"])
sns.scatterplot(data=df, x="x", y="y")
plt.show()

# train and synthesize
dpgan = PATECTGAN(epsilon=eps)
dpgan.train(np_data_xy, categorical_columns=[0, 1])
synth_data = dpgan.generate(size)
synth_df = pd.DataFrame(synth_data, columns=["x", "y"])

sns.scatterplot(data=synth_df, x="x", y="y")
sns.kdeplot(data=synth_df, x="x", y="y", levels=5, alpha=0.5, fill=True)
plt.show()

expected: density plot with most mass on the diagonal

observed: density plot with mass evenly spread across all combinations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant