Comments (4)
gretelai/public_research#4 fixes function calls in the sample_usage.ipynb
notebook.
from gretel-synthetics.
Created a new environment with fresh install and got it resolved... (python 3.9, gretel 1.19.0, numpy 1.23.5)
Still though, when trying example code with example and my own data. I'm stuck with following error, i've been looking in the code itself, but can't understand why it would show this error.
import numpy as np
from gretel_synthetics.timeseries_dgan.dgan import DGAN
from gretel_synthetics.timeseries_dgan.config import DGANConfig
attributes = np.random.rand(10000, 3)
features = np.random.rand(10000, 20, 2)
config = DGANConfig(
max_sequence_len=20,
sample_len=5,
batch_size=1000,
epochs=10
)
model = DGAN(config)
model.train_numpy(attributes, features)
synthetic_attributes, synthetic_features = model.generate(1000)
producing:
Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?6cf10b5a-7b85-44a9-8b33-22bedba04389)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In [8], line 13
6 config = DGANConfig(
7 max_sequence_len=20,
8 sample_len=5,
9 batch_size=1000,
10 epochs=10
11 )
12 model = DGAN(config)
---> 13 model.train_numpy(attributes, features)
14 synthetic_attributes, synthetic_features = model.generate(1000)
File c:\Users\jankr\miniconda3\envs\tf\lib\site-packages\gretel_synthetics\timeseries_dgan\dgan.py:194, in DGAN.train_numpy(self, features, feature_types, attributes, attribute_types)
191 _check_for_nans(attributes, features)
193 if not self.is_built:
--> 194 attribute_outputs, feature_outputs = create_outputs_from_data(
195 attributes,
196 features,
197 attribute_types,
198 feature_types,
199 normalization=self.config.normalization,
200 apply_feature_scaling=self.config.apply_feature_scaling,
201 apply_example_scaling=self.config.apply_example_scaling,
202 )
...
90 "feature_types must be the same length as the 3rd (last) dimemnsion of features"
91 )
92 feature_types = cast(List[OutputType], feature_types)
IndexError: tuple index out of range
from gretel-synthetics.
I'm guessing a bit since the full stack trace is truncated, but the order of arguments to train_numpy
looks wrong. That example usage and actual code are out of sync I think. Thanks for including the link so I can confirm and get it fixed right away.
Try the following line for the train_numpy
call using keyword args instead:
model.train_numpy(attributes=attributes, features=features)
And this also explains that original error you saw too. From the current source code (which should be exactly what's in version 0.19.0),
def train_numpy(
self,
features: np.ndarray,
feature_types: Optional[List[OutputType]] = None,
attributes: Optional[np.ndarray] = None,
attribute_types: Optional[List[OutputType]] = None,
):
So in your opening post, replacing the positional args with keyword versions from the order above, the function call was:
model.train_numpy(
features=attributes, feature_types=features,
attribute_types = [OutputType.DISCRETE] * 3,
feature_types = [OutputType.CONTINUOUS] * 2
)
Hence the error about feature_types
given twice.
from gretel-synthetics.
Notebook examples are updated now. Thanks for making us aware of these outdated examples!
Closing this issue. Please reopen if there are further problems running the example code.
from gretel-synthetics.
Related Issues (20)
- Performance issue in /src/gretel_synthetics/tensorflow (by P3) HOT 1
- [BUG] Incompatability with package dependence HOT 2
- timeseries_dgan.ipynb example - error from train_numpy HOT 2
- TypeError: __init__() got an unexpected keyword argument 'prefetch_factor' HOT 1
- Poor training results HOT 6
- TooManyInvalidError: Maximum number of invalid lines reached! HOT 3
- [FR] Generation based on given attributes HOT 2
- [FR / BUG] HOT 2
- Bug HOT 5
- Sample_len Value HOT 2
- Results about DGAN
- [BUG] : Loading a trained model and generating synthetic data throws an error HOT 8
- About DoppelGANger training results HOT 1
- [BUG]: Outdated category_encoders HOT 3
- List index out of range HOT 4
- ValueError: multiprocessing_context option should specify a valid start method in ['spawn'], but got multiprocessing_context='fork'[FR / BUG] HOT 1
- [BUG] example notebook error HOT 3
- Marketoptiontend-analysis
- DGAN for ECG dataset HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gretel-synthetics.