ydataai / ydata-synthetic

Synthetic data generators for tabular and time-series data
https://docs.synthetic.ydata.ai
MIT License
1.38k stars 232 forks source link

[BUG] Cannot import name 'TimeGAN' from 'ydata_synthetic.synthesizers.timeseries' #300

Closed wjjessen closed 6 months ago

wjjessen commented 11 months ago

Describe the bug I'm following this example notebook in the default 'dev' branch:

https://github.com/ydataai/ydata-synthetic/blob/dev/examples/timeseries/TimeGAN_Synthetic_stock_data.ipynb

I get an import error from this line:

from ydata_synthetic.synthesizers.timeseries import TimeGAN ImportError: cannot import name 'TimeGAN' from 'ydata_synthetic.synthesizers.timeseries'

I'm using ydata-synthetic version 1.3.0 (which requires Python >=3.9, <3.11) and Python 3.10.

What am I doing wrong here?

To Reproduce Steps to reproduce the behavior:

  1. Create and activate a virtual environment (virtualenv) with Python 3.10
  2. pip3 install ydata_synthetic (also installs necessary dependencies all listed below)
  3. Create a new notebook in VS Code
  4. Copy and paste the code from the notebook linked above
  5. See error

Expected behavior No import error.

Desktop (please complete the following information):

Additional context Packages in the environment:

absl-py 1.4.0 asttokens 2.2.1 astunparse 1.6.3 atomicwrites 1.4.1 attrs 23.1.0 backcall 0.2.0 cachetools 5.3.1 certifi 2023.7.22 charset-normalizer 3.2.0 cloudpickle 2.2.1 colorama 0.4.6 comm 0.1.4 contourpy 1.1.0 cycler 0.11.0 debugpy 1.6.7.post1 decorator 5.1.1 dm-tree 0.1.8 easydict 1.10 executing 1.2.0 flatbuffers 23.5.26 fonttools 4.42.0 fsspec 2023.6.0 gast 0.4.0 google-auth 2.22.0 google-auth-oauthlib 1.0.0 google-pasta 0.2.0 grpcio 1.56.2 h5py 3.9.0 idna 3.4 iniconfig 2.0.0 ipykernel 6.25.1 ipython 8.14.0 jax 0.4.14 jedi 0.19.0 joblib 1.3.2 jupyter_client 8.3.0 jupyter_core 5.3.1 keras 2.12.0 kiwisolver 1.4.4 libclang 16.0.6 Markdown 3.4.4 MarkupSafe 2.1.3 matplotlib 3.7.2 matplotlib-inline 0.1.6 ml-dtypes 0.2.0 nest-asyncio 1.5.7 numpy 1.23.5 oauthlib 3.2.2 opt-einsum 3.3.0 packaging 23.1 pandas 2.0.3 parso 0.8.3 pickleshare 0.7.5 Pillow 10.0.0 pip 23.2.1 platformdirs 3.10.0 pluggy 1.2.0 pmlb 1.0.1.post3 prompt-toolkit 3.0.39 protobuf 4.24.0 psutil 5.9.5 pure-eval 0.2.2 py 1.11.0 pyarrow 12.0.1 pyasn1 0.5.0 pyasn1-modules 0.3.0 Pygments 2.16.1 pyparsing 3.0.9 pytest 6.2.5 python-dateutil 2.8.2 pytz 2023.3 pywin32 306 PyYAML 6.0.1 pyzmq 25.1.0 requests 2.30.0 requests-oauthlib 1.3.1 rsa 4.9 scikit-learn 1.2.2 scipy 1.11.1 setuptools 68.0.0 six 1.16.0 stack-data 0.6.2 tensorboard 2.12.3 tensorboard-data-server 0.7.1 tensorflow 2.12.0 tensorflow-estimator 2.12.0 tensorflow-intel 2.12.0 tensorflow-io-gcs-filesystem 0.31.0 tensorflow-probability 0.19.0 termcolor 2.3.0 threadpoolctl 3.2.0 toml 0.10.2 tornado 6.3.2 tqdm 4.66.0 traitlets 5.9.0 typeguard 4.0.1 typing_extensions 4.7.1 tzdata 2023.3 urllib3 1.26.16 wcwidth 0.2.6 Werkzeug 2.3.6 wheel 0.41.0 wrapt 1.14.1 ydata-synthetic 1.3.0

SiggyF commented 10 months ago

The TimeGAN model was removed from the init.py at that level. A TimeSeriesSynthesizer class is now available as a facade to both TimeGAN and DoppelGanger. You can directly import TimeGAN as from ydata_synthetic.synthesizers.timeseries.timegan.model import TimeGAN.

In the current version the function calls do not match with the examples anymore. So the example needs an update to the latest TimeGAN or the TimeSeriesSynthesizer. You should be able to run the example with an older version, e.g. pip install ydata-synthetic<1.3.0

cptanalatriste commented 9 months ago

I have updated the Jupyter Notebook in this PR: https://github.com/ydataai/ydata-synthetic/pull/310