Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

record Keras models created in the context of a probmodel #199

Open
rcabanasdepaz opened this issue Jan 8, 2020 · 0 comments
Open

record Keras models created in the context of a probmodel #199

rcabanasdepaz opened this issue Jan 8, 2020 · 0 comments
Assignees

Comments

@rcabanasdepaz
Copy link
Member

rcabanasdepaz commented Jan 8, 2020

Consider the following model:

@inf.probmodel
def vae(k, d0, d, decoder):
    with inf.datamodel():
        z = inf.Normal(tf.ones(k), 1,name="z")
        x = inf.Normal(decoder(d0, d, z), 1, name="x")

def decoder(d0, d, z):
    return inf.keras.Sequential([
        tf.keras.layers.Dense(d0),
        tf.keras.layers.Dense(d, activation="relu"),
    ], name="decoder")(z)



p = vae(k=2, d0=100, d=28*28, decoder=decoder)

We might need to access to the keras model defined:

>>> p.prior().keras()
 {'decoder': <tensorflow.python.keras.engine.sequential.Sequential at 0x12d722668>}

>>> p.posterior().keras()
 {'decoder': <tensorflow.python.keras.engine.sequential.Sequential at 0x12e842634>}

Like with RV, these could be the prior or posterior models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant