Rename weightDecay to l2Lambda
Rbm::Params::weightDecay is now applied directly to the weights outside the momentum recursion (previous commit), exactly like the newly-added l1Lambda and matching pyRBM's l2_lambda -- same lambda*W gradient form, same decoupled-from-momentum treatment. The two are functionally the same mechanism in this codebase, so name it accordingly. Renamed the Params field, its JSON key, and the two GUI references in MainComponent.cpp that read/write it (the "weightDecayLabel" widget identifier and its JUCE-generated marker comment are left as-is -- cosmetic, not part of the actual API). Existing .prj files still have a "weightDecay" JSON key; fromJson() no longer reads it, so it's silently ignored on load. Harmless today since every current project has it set to 0.0 (confirmed: unchanged poet.elf output, unchanged test-suite results). Not migrating the .prj files themselves in this change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016K8Gu7Qejd11JbdiHZqYAs
This commit is contained in:
+5
-5
@@ -367,14 +367,14 @@ void Rbm::train(arma::mat const &batch, IListener* pListener)
|
||||
m_bh += inc_bh;
|
||||
m_whv += inc_whv;
|
||||
|
||||
// Weight decay and L1 applied directly to the weights, outside the
|
||||
// momentum recursion above -- folding either into inc_whv would let
|
||||
// momentum geometrically amplify its effective strength to roughly
|
||||
// L2 and L1 applied directly to the weights, outside the momentum
|
||||
// recursion above -- folding either into inc_whv would let momentum
|
||||
// geometrically amplify its effective strength to roughly
|
||||
// lambda/(1-momentum), well past the configured value. Neither
|
||||
// touches the biases, matching pyRBM's state_adjust().
|
||||
if (m_params.weightDecay != 0.0)
|
||||
if (m_params.l2Lambda != 0.0)
|
||||
{
|
||||
m_whv -= m_params.learningRate*m_params.weightDecay*m_whv;
|
||||
m_whv -= m_params.learningRate*m_params.l2Lambda*m_whv;
|
||||
}
|
||||
if (m_params.l1Lambda != 0.0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user