opendp / smartnoise-sdk

Tools and service for differentially private processing of tabular and relational data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Verbose Feature on MWEM No Longer Compatible with Python 3.7

GenericP3rson opened this issue · comments

Running smartnoise-synth==0.3.5.
Python Version: Python 3.7.0

It looks like MWEM is no longer compatible with Python 3.7 when the verbose function is set to true (even though the README indicates the package is compatible with Python 3.7).

Code (slightly modified from from the docs):

from snsynth import Synthesizer
import pandas as pd

pums = pd.read_csv('PUMS.csv', index_col=None) # in datasets
pums = pums.drop(['income', 'age'], axis=1)

synth = Synthesizer.create('mwem', epsilon=1.0, verbose=True)
sample = synth.fit_sample(pums)
print(sample)

Error:

AttributeError: module 'math' has no attribute 'comb'

This error is because "comb" is a new method in Python 3.8 that does not exist in Python 3.7.

The function works without the verbose=True parameter or with Python 3.8.

Thanks for reporting and pinpointing the root cause. The bug is fixed and pushed to smartnoise-synth==3.5.1 on PyPi.

Awesome, it's working now! Thank you so much!