pybnn icon indicating copy to clipboard operation
pybnn copied to clipboard

BUG: printed_every_n_steps and keep_every cannot be equal

Open bangxiangyong opened this issue 5 years ago • 2 comments

When print_every_n_steps and keep_every are set to equal, the network is not updated properly

Following the notebook example:

model = Bohamiann(print_every_n_steps=50)
model.train(x[:, None], y, num_steps=20000, num_burn_in_steps=2000, keep_every=50, lr=1e-2, verbose=True)

results in : bug

The reason is because the seemingly innocent print_every_n_steps does an important job in the background : by calling network_predict, implicitly the current weights is reset to the latest sampled_weights via the line : self.network_weights = weights

Upon removing the line where it prints the network performance, we can log and notice the drifting loss weights prior shown as WP here:

growing p_w

bangxiangyong avatar Dec 31 '19 00:12 bangxiangyong

good catch thanks, could you send a PR to fix it?

aaronkl avatar Dec 31 '19 16:12 aaronkl

I don't know how to fix it unfortunately !..

bangxiangyong avatar Jan 07 '20 02:01 bangxiangyong