How to do it...

The code setup for the autoencoder can directly be converted to a regularized autoencoder by replacing the cost definition with the following lines:

Lambda=0.01
cost = tf$reduce_mean(tf$pow(x - y_pred, 2))
Regularize_weights = tf$nn$l2_loss(weights)
cost = tf$reduce_mean(cost + lambda * Regularize_weights)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset