Git Product home page Git Product logo

Comments (4)

roatienza avatar roatienza commented on May 29, 2024

Hi. For the test set, when data is encoded, the z_mean is generated by the encoder.

z, _, _ = encoder.predict([x_test, to_categorical(y_test)],

For CVAE, this is expected to be almost evenly distributed within a circle (2d z_mean). z_mean changes depending on the input test data.

from advanced-deep-learning-with-keras.

tuthang102 avatar tuthang102 commented on May 29, 2024

encoder = Model([inputs, y_labels],
[z_mean, z_log_var, z],
name='encoder')

The output of the encoder is z_mean, z_log_var, z. I understand the z_mean is generated by the encoder, the problem I'm having is the values for z_mean are all the same for all the input test data. in CVAE. This is not the case when working with regular VAE.

from advanced-deep-learning-with-keras.

roatienza avatar roatienza commented on May 29, 2024

CVAE (and VAE) encoder z_mean distribution has an objective function to approximate a Gaussian with zero mean and std=1. On the test set, this can be verified by inserting this code:

z, _, _ = encoder.predict([x_test, to_categorical(y_test)],
                          batch_size=batch_size)
print("shape:", z.shape)
print("mean:", np.mean(z, axis=0))
print("std:", np.std(z, axis=0))
return

Then, it prints (verifying it is not constant but a distribution):

shape: (10000, 2)
mean: [ 0.07939055 0.02497174]
std: [ 0.91762519 0.92036796]

from advanced-deep-learning-with-keras.

tuthang102 avatar tuthang102 commented on May 29, 2024

When I plot the 10000 values, it does not resemble a normal distribution. All 10000 values are the same. This is for CVAE model only, the VAE model does produce a latent vector z with a normal distribution.

from advanced-deep-learning-with-keras.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.