Skip to content

Commit

Permalink
fixed norm bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnLangford committed Jan 12, 2012
1 parent 6186f55 commit 9746948
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vowpalwabbit/gd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -723,11 +723,13 @@ void local_predict(example* ec, gd_vars& vars, regressor& reg)
eta_t = global.eta * norm / magx;
} else {
eta_t = global.eta / powf(t,vars.power_t) * ld->weight;
if (global.nonormalize) eta_t *= ec->total_sum_feat_sq;
if (global.nonormalize)
eta_t *= ec->total_sum_feat_sq;
else
norm = ec->total_sum_feat_sq;
}

ec->eta_round = reg.loss->getUpdate(ec->final_prediction, ld->label, eta_t, norm) / global.sd->contraction;

if (global.reg_mode && fabs(ec->eta_round) > 1e-8) {
double dev1 = reg.loss->first_derivative(ec->final_prediction, ld->label);
double eta_bar = (fabs(dev1) > 1e-8) ? (-ec->eta_round / dev1) : 0.0;
Expand Down

0 comments on commit 9746948

Please sign in to comment.