Skip to content

Instantly share code, notes, and snippets.

@fabclmnt
fabclmnt / synth_sample.py
Created May 24, 2023 06:09
Generating synthetic data
synth_data = synth.sample(1000)
print(synth_data)
@fabclmnt
fabclmnt / setting_gmm.py
Created May 24, 2023 06:02
Creating a ydata-synthetic synthesizer with GMMs
synth = RegularSynthesizer(modelname='fast')
synth.fit(data=data, num_cols=num_cols, cat_cols=cat_cols)
@fabclmnt
fabclmnt / setting_cols.py
Created May 24, 2023 06:00
Set numerical and categorical columns for synthesis
data = fetch_data('adult')
num_cols = ['age', 'fnlwgt', 'capital-gain', 'capital-loss', 'hours-per-week']
cat_cols = ['workclass','education', 'education-num', 'marital-status', 'occupation', 'relationship', 'race', 'sex',
'native-country', 'target']
@fabclmnt
fabclmnt / imports.py
Created May 24, 2023 05:58
import ydata_synthetic
from pmlb import fetch_data
from ydata_synthetic.synthesizers.regular import RegularSynthesizer
from ydata_synthetic.synthesizers import ModelParameters, TrainParameters
@fabclmnt
fabclmnt / ydata_synth.cmd
Created May 24, 2023 05:56
install ydata-synthetic
`pip install ydata-synthetic==1.2.0`
@fabclmnt
fabclmnt / output_format.txt
Created April 15, 2023 14:06
ydata_synthetic Common questions
2023-03-20 | Val_1 | Val_2 | Val_3
2023-03-19 | Val_1 | Val_2 | Val_3
2023-03-18 | Val_1 | Val_2 | Val_3
2023-03-17 | Val_1 | Val_2 | Val_3
2023-03-16 | Val_1 | Val_2 | Val_3
(...)
2023-02-03 | Val_1 | Val_2 | Val_3
2023-02-02 | Val_1 | Val_2 | Val_3
2023-02-01 | Val_1 | Val_2 | Val_3
(...)
@fabclmnt
fabclmnt / import_train_timeGAN.py
Created April 15, 2023 12:58
ydata_synthetic Common questions
# Defining general model parameters
batch_size = 128
learning_rate = 5e-4
noise_dim = 128
dim = 128
gan_args = ModelParameters(batch_size=batch_size,
                                                   lr=learning_rate,
                                                   noise_dim=noise_dim,
                                                   layers_dim=dim)
@fabclmnt
fabclmnt / load_data.py
Created April 15, 2023 12:56
ydata_synthetic Common questions
stock_data_df =
pd.read_csv("https://raw.githubusercontent.com/ydataai/ydata-synthetic/70504e2158a1194bc5075ee8cae7560277c39b4d/data/stock_data.csv")
@fabclmnt
fabclmnt / import_timegan.py
Created April 15, 2023 12:55
ydata_synthetic Common questions
import pandas as pd
from ydata_synthetic.synthesizers import ModelParameters
from ydata_synthetic.synthesizers.timeseries import TimeGAN
from ydata_synthetic.preprocessing.timeseries.utils import real_data_loading
@fabclmnt
fabclmnt / conda_env.sh
Last active April 15, 2023 12:54
create_conda_env
conda create --name synth-env python==3.9 pip
conda activate synth-env
pip install ydata-synthetic==v1.0.1