synthesized3.model.models package#

class synthesized3.model.models.DeepTableModel#

Bases: Functional, Model

A Table model and keras.Model for deep generative synthesis.

NOTE: we inherit from keras.engines.functional.Functional not keras.Model to avoid errors with multiple inheritance.

__init__(meta_collection: MetaCollection, engine: Type[Layer] | None = None, name: str = 'DeepTableModel', **kwargs)#
train_step(data)#

Train step for the model keras model.

Overriding allows us to use the inputs and compare them with the y_pred. This way, we don’t have to pass in the additional output tensors in the fitting process.

compute_loss(x=None, y=None, y_pred=None, sample_weight=None)#

custom compute_loss that uses tf.nn.compute_average_loss to reduce loss over global batch

sample(num_rows: int, seed: int | None = None) Dict[str, Tensor]#

Sample from the model.

Parameters:
  • num_rows (int) – Number of rows to sample.

  • seed (int) – Random seed.

classmethod from_meta_collection(meta_collection: MetaCollection, **kwargs) DeepTableModel#
get_callbacks(distributed: bool) List[Callback]#

Get any default callbacks for training.

class synthesized3.model.models.SamplingModel#

Bases: Model

Model that samples the unique values of one column.

Metas corresponding to the column must be CategoricalMeta. The sampled values are indices that correspond to the categories of the associated CategoricalMeta.To synthesize the actual categories this model must be followed by an inverse CategoricalTransformer.

Parameters:
  • meta_collection – MetaCollection containing the categorical meta.

  • name – Name of the model. Defaults to “SamplingModel”

__init__(meta_collection: MetaCollection, name: str = 'SamplingModel')#
fit(data, epochs, steps_per_epoch, callbacks=None, verbose=0)#

Fit the model on a single machine.

Parameters:
  • data (tf.data.Dataset) – Data.

  • epochs (int) – Number of epochs.

  • steps_per_epoch (int) – Number of steps per epoch.

  • callbacks (List[tf.keras.callbacks.Callback], optional) – Optional callbacks to hook into training procedure

  • verbose (int) – Training verbosity. 0 is silent, 1 provides updates every epoch and 2 updates every batch.

sample(num_rows: int, seed: int | None = None) Dict[str, Tensor]#

Sample from the model.

Parameters:
  • num_rows (int) – Number of rows to sample.

  • seed (int) – Random seed.

class synthesized3.model.models.EnumerationModel#

Bases: Model

Model that enumerates row indexes.

__init__(meta_collection: MetaCollection, start: int = 1, step: int = 1, name: str = 'EnumerationModel')#
dtype: DType#
fit(data, epochs, steps_per_epoch, callbacks=None, verbose=0)#

Fit the model on a single machine.

Parameters:
  • data (tf.data.Dataset) – Data.

  • epochs (int) – Number of epochs.

  • steps_per_epoch (int) – Number of steps per epoch.

  • callbacks (List[tf.keras.callbacks.Callback], optional) – Optional callbacks to hook into training procedure

  • verbose (int) – Training verbosity. 0 is silent, 1 provides updates every epoch and 2 updates every batch.

sample(num_rows: int, seed: int | None = None)#

Sample from the model.

Parameters:
  • num_rows (int) – Number of rows to sample.

  • seed (int) – Random seed.

Submodules#

synthesized3.model.models.deep_table_model module#

class synthesized3.model.models.deep_table_model.DeepTableModel#

Bases: Functional, Model

A Table model and keras.Model for deep generative synthesis.

NOTE: we inherit from keras.engines.functional.Functional not keras.Model to avoid errors with multiple inheritance.

__init__(meta_collection: MetaCollection, engine: Type[Layer] | None = None, name: str = 'DeepTableModel', **kwargs)#
train_step(data)#

Train step for the model keras model.

Overriding allows us to use the inputs and compare them with the y_pred. This way, we don’t have to pass in the additional output tensors in the fitting process.

compute_loss(x=None, y=None, y_pred=None, sample_weight=None)#

custom compute_loss that uses tf.nn.compute_average_loss to reduce loss over global batch

sample(num_rows: int, seed: int | None = None) Dict[str, Tensor]#

Sample from the model.

Parameters:
  • num_rows (int) – Number of rows to sample.

  • seed (int) – Random seed.

classmethod from_meta_collection(meta_collection: MetaCollection, **kwargs) DeepTableModel#
get_callbacks(distributed: bool) List[Callback]#

Get any default callbacks for training.

synthesized3.model.models.deep_table_model_test module#

synthesized3.model.models.enumeration_model module#

class synthesized3.model.models.enumeration_model.EnumerationModel#

Bases: Model

Model that enumerates row indexes.

__init__(meta_collection: MetaCollection, start: int = 1, step: int = 1, name: str = 'EnumerationModel')#
dtype: DType#
fit(data, epochs, steps_per_epoch, callbacks=None, verbose=0)#

Fit the model on a single machine.

Parameters:
  • data (tf.data.Dataset) – Data.

  • epochs (int) – Number of epochs.

  • steps_per_epoch (int) – Number of steps per epoch.

  • callbacks (List[tf.keras.callbacks.Callback], optional) – Optional callbacks to hook into training procedure

  • verbose (int) – Training verbosity. 0 is silent, 1 provides updates every epoch and 2 updates every batch.

sample(num_rows: int, seed: int | None = None)#

Sample from the model.

Parameters:
  • num_rows (int) – Number of rows to sample.

  • seed (int) – Random seed.

synthesized3.model.models.enumeration_model_test module#

synthesized3.model.models.sampling_model module#

class synthesized3.model.models.sampling_model.SamplingModel#

Bases: Model

Model that samples the unique values of one column.

Metas corresponding to the column must be CategoricalMeta. The sampled values are indices that correspond to the categories of the associated CategoricalMeta.To synthesize the actual categories this model must be followed by an inverse CategoricalTransformer.

Parameters:
  • meta_collection – MetaCollection containing the categorical meta.

  • name – Name of the model. Defaults to “SamplingModel”

__init__(meta_collection: MetaCollection, name: str = 'SamplingModel')#
fit(data, epochs, steps_per_epoch, callbacks=None, verbose=0)#

Fit the model on a single machine.

Parameters:
  • data (tf.data.Dataset) – Data.

  • epochs (int) – Number of epochs.

  • steps_per_epoch (int) – Number of steps per epoch.

  • callbacks (List[tf.keras.callbacks.Callback], optional) – Optional callbacks to hook into training procedure

  • verbose (int) – Training verbosity. 0 is silent, 1 provides updates every epoch and 2 updates every batch.

sample(num_rows: int, seed: int | None = None) Dict[str, Tensor]#

Sample from the model.

Parameters:
  • num_rows (int) – Number of rows to sample.

  • seed (int) – Random seed.

synthesized3.model.models.sampling_model_test module#