Skip to content
Browse files

Merge branch 'master' of git://github.com/JohnLangford/vowpal_wabbit

  • Loading branch information...
2 parents a3cd1c8 + b33b787 commit 488f98a02ad323a549b64fce4d8ce4621f15e8f3 @hal3 hal3 committed Jan 19, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 vowpalwabbit/bfgs.cc
View
9 vowpalwabbit/bfgs.cc
@@ -259,7 +259,7 @@ double direction_magnitude(regressor& reg)
g1_Hg1/importance_weight_sum, "", "", "");
}
- void bfgs_iter_middle(regressor&reg, float* mem, double* rho, double* alpha, int& lastj, int &origin) throw (curv_exception)
+void bfgs_iter_middle(regressor&reg, float* mem, double* rho, double* alpha, int& lastj, int &origin) throw (curv_exception)
{
uint32_t length = 1 << global.num_bits;
size_t stride = global.stride;
@@ -530,6 +530,7 @@ void work_on_weights(bool &gradient_pass, regressor &reg, string &final_regresso
/********************************************************************/
/* B) GRADIENT CALCULATED *******************************************/
/********************************************************************/
+
if (gradient_pass) // We just finished computing all gradients
{
if(global.span_server != "") {
@@ -704,10 +705,12 @@ void learn(example* ec)
gradient_pass = false;//now start computing curvature
}
else
- work_on_weights(gradient_pass, global.reg, global.final_regressor_name,
+ {
+ work_on_weights(gradient_pass, global.reg, global.final_regressor_name,
loss_sum, importance_weight_sum, step_size, previous_loss_sum,
current_pass, curvature, mem, predictions,
example_number, rho, alpha, lastj, origin, final_pass);
+ }
current_pass++;
/********************************************************************/
@@ -787,6 +790,8 @@ void finish()
void initializer()
{
+ int m = global.m;
+
mem_stride = (m==0) ? CG_EXTRA : 2*m;
mem = (float*) malloc(sizeof(float)*global.length()*(mem_stride));
rho = (double*) malloc(sizeof(double)*m);

0 comments on commit 488f98a

Please sign in to comment.
Something went wrong with that request. Please try again.