pygan.discriminativemodel.autoencodermodel package

Submodules

pygan.discriminativemodel.autoencodermodel.convolutional_auto_encoder module

class pygan.discriminativemodel.autoencodermodel.convolutional_auto_encoder.ConvolutionalAutoEncoder(convolutional_auto_encoder=None, batch_size=10, channel=1, learning_rate=1e-10, learning_attenuate_rate=0.1, attenuate_epoch=50, opt_params=None, feature_matching_layer=0)[source]

Bases: pygan.discriminativemodel.auto_encoder_model.AutoEncoderModel

Stacked Convolutional Auto-Encoder as a Discriminative Model which discriminates true from fake.

The Energy-based GAN framework considers the discriminator as an energy function, which assigns low energy values to real data and high to fake data. The generator is a trainable parameterized function that produces samples in regions to which the discriminator assigns low energy.

References

  • Manisha, P., & Gujar, S. (2018). Generative Adversarial Networks (GANs): What it can generate and What it cannot?. arXiv preprint arXiv:1804.00140.
  • Zhao, J., Mathieu, M., & LeCun, Y. (2016). Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126.
convolutional_auto_encoder

getter

feature_matching_backward(grad_arr)[source]

Back propagation in only first or intermediate layer for so-called Feature matching.

Parameters:observed_arrnp.ndarray of observed data points.
Returns:np.ndarray of outputs.
feature_matching_forward(observed_arr)[source]

Forward propagation in only first or intermediate layer for so-called Feature matching.

Like C-RNN-GAN(Mogren, O. 2016), this model chooses the last layer before the output layer in this Discriminator.

Parameters:observed_arrnp.ndarray of observed data points.
Returns:np.ndarray of outputs.
get_convolutional_auto_encoder()[source]

getter

get_loss()[source]

getter

get_pre_loss_arr()[source]

getter

inference(observed_arr)[source]

Draws samples from the fake distribution.

Parameters:observed_arrnp.ndarray of observed data points.
Returns:np.ndarray of inferenced.
learn(grad_arr, fix_opt_flag=False)[source]

Update this Discriminator by ascending its stochastic gradient.

Parameters:
  • grad_arrnp.ndarray of gradients.
  • fix_opt_flag – If False, no optimization in this model will be done.
Returns:

np.ndarray of delta or gradients.

loss

getter

pre_learn(true_sampler, epochs=1000)[source]

Pre learning.

Parameters:
  • true_sampler – is-a TrueSampler.
  • epochs – Epochs.
pre_loss_arr

getter

set_convolutional_auto_encoder(value)[source]

setter

set_loss(value)[source]

setter

set_readonly(value)[source]

setter

pygan.discriminativemodel.autoencodermodel.encoder_decoder_model module

class pygan.discriminativemodel.autoencodermodel.encoder_decoder_model.EncoderDecoderModel(encoder_decoder_controller, seq_len=10, learning_rate=1e-10, learning_attenuate_rate=0.1, attenuate_epoch=50)[source]

Bases: pygan.discriminativemodel.auto_encoder_model.AutoEncoderModel

Encoder/Decoder based on LSTM as a Discriminative Model which discriminates true from fake.

The Energy-based GAN framework considers the discriminator as an energy function, which assigns low energy values to real data and high to fake data. The generator is a trainable parameterized function that produces samples in regions to which the discriminator assigns low energy.

References

  • Manisha, P., & Gujar, S. (2018). Generative Adversarial Networks (GANs): What it can generate and What it cannot?. arXiv preprint arXiv:1804.00140.
  • Zhao, J., Mathieu, M., & LeCun, Y. (2016). Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126.
encoder_decoder_controller

getter

feature_matching_backward(grad_arr)[source]

Back propagation in only first or intermediate layer for so-called Feature matching.

Parameters:observed_arrnp.ndarray of observed data points.
Returns:np.ndarray of outputs.
feature_matching_forward(observed_arr)[source]

Forward propagation in only first or intermediate layer for so-called Feature matching.

Like C-RNN-GAN(Mogren, O. 2016), this model chooses the last layer before the output layer in this Discriminator.

Parameters:observed_arrnp.ndarray of observed data points.
Returns:np.ndarray of outputs.
get_encoder_decoder_controller()[source]

getter

get_pre_loss_arr()[source]

getter

inference(observed_arr)[source]

Draws samples from the fake distribution.

Parameters:observed_arrnp.ndarray of observed data points.
Returns:np.ndarray of inferenced.
learn(grad_arr, fix_opt_flag=False)[source]

Update this Discriminator by ascending its stochastic gradient.

Parameters:
  • grad_arrnp.ndarray of gradients.
  • fix_opt_flag – If False, no optimization in this model will be done.
Returns:

np.ndarray of delta or gradients.

pre_learn(true_sampler, epochs=1000)[source]

Pre learning.

Parameters:
  • true_sampler – is-a TrueSampler.
  • epochs – Epochs.
pre_loss_arr

getter

set_encoder_decoder_controller(value)[source]

setter

set_readonly(value)[source]

setter

Module contents