Skip to content

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

@rcabanasdepaz

Description

@rcabanasdepaz

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions