I have this code:
# Build the PFN model
model = Sequential([
Dense(32, input_shape=(sequence_length, num_features)),
tfp.layers.DenseVariational(
units=32,
make_posterior_fn=lambda posterior_tensor:
tfp.layers.VariableLayer(tfp.layers.MultivariateNormalTriL.params_size(num_features))(posterior_tensor),
make_prior_fn=lambda prior_tensor: tfp.layers.VariableLayer(tfp.layers.MultivariateNormalTriL.params_size(num_features))(prior_tensor),
kl_weight=1/X_train_scaled.shape[0],
activation='relu'
),
Dropout(0.1),
tfp.layers.DenseVariational(
units=32,
make_posterior_fn=lambda posterior_tensor: tfp.layers.VariableLayer(tfp.layers.MultivariateNormalTriL.params_size(num_features))(posterior_tensor),
make_prior_fn=lambda prior_tensor: tfp.layers.VariableLayer(tfp.layers.MultivariateNormalTriL.params_size(num_features))(prior_tensor),
kl_weight=1/X_train_scaled.shape[0],
activation='relu'
),
Dropout(0.1),
tfp.layers.DenseVariational(
units=1,
make_posterior_fn=lambda posterior_tensor: tfp.layers.VariableLayer(tfp.layers.MultivariateNormalTriL.params_size(1))(posterior_tensor),
make_prior_fn=lambda prior_tensor: tfp.layers.VariableLayer(tfp.layers.MultivariateNormalTriL.params_size(1))(prior_tensor),
kl_weight=1/X_train_scaled.shape[0]
)
])`
But I get this error:
TypeError: <lambda>() takes 1 positional argument but 3 were given
I tried adding the variables needed. Still I am getting the error.
I added the missing variables needed. Restructured the code if that was the problem, gave values to the variables in case that was why the error was coming up.