opendp / smartnoise-sdk

Tools and service for differentially private processing of tabular and relational data
MIT License
254 stars 68 forks source link

issues with depreciated numpy.product #605

Open lou2606 opened 1 month ago

lou2606 commented 1 month ago

It seems there is a problem with the snsynth/mwem.py script. When running it, I encountered the following error:


574 if any([a > 0 for a in mins_data]):
    575     warnings.warn("Data should be preprocessed to have 0 based indices.")
--> 576 dimensionality = np.product(dims_sizes)
    577 if dimensionality > 1e8:
    578     warnings.warn(f"Dimensionality of histogram is {dimensionality:,}, consider using splits.")

File /opt/conda/lib/python3.12/site-packages/numpy/__init__.py:414, in __getattr__(attr)
    411     import numpy.char as char
    412     return char.chararray
--> 414 raise AttributeError("module {!r} has no attribute "
    415                      "{!r}".format(__name__, attr))
AttributeError: module 'numpy' has no attribute 'product' 

This error occurs because numpy.product has been deprecated in NumPy version 1.25.0. The fix is straightforward—simply change np.product on line 576 to np.prod.