From 4482fe7a82e3f9a197bf65d60635885c4bfab195 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 17 Mar 2011 22:53:19 -0400 Subject: try 2 --- training/online_optimizer.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'training') diff --git a/training/online_optimizer.h b/training/online_optimizer.h index 61d62a37..28d89344 100644 --- a/training/online_optimizer.h +++ b/training/online_optimizer.h @@ -92,7 +92,11 @@ class CumulativeL1OnlineOptimizer : public OnlineOptimizer { void ResetEpochImpl() { u_ = 0; } void UpdateWeightsImpl(const double& eta, const SparseVector& approx_g, int max_feat, SparseVector* weights) { u_ += eta * C_ / N_; - (*weights) += eta * approx_g; + for (SparseVector::const_iterator it = approx_g.begin(); + it != approx_g.end(); ++it) { + if (frozen_.count(it->first) == 0) + weights->add_value(it->first, eta * it->second); + } for (int i = 1; i < max_feat; ++i) if (frozen_.count(i) == 0) ApplyPenalty(i, weights); } -- cgit v1.2.3