Skip to content

Commit

Permalink
Added proximal penalty to objective value used in line search.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasnykodym committed Feb 28, 2015
1 parent 47eafb8 commit d8605e7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/hex/glm/GLM2.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public GLM2 setHighAccuracy(){
}

private double objval(GLMIterationTask glmt){
return glmt._val.residual_deviance / glmt._nobs + 0.5 * l2pen() * l2norm(glmt._beta) + l1pen() * l1norm(glmt._beta);
return glmt._val.residual_deviance / glmt._nobs + 0.5 * l2pen() * l2norm(glmt._beta) + l1pen() * l1norm(glmt._beta) + proxPen(glmt._beta);
}

private IterationInfo makeIterationInfo(int i, GLMIterationTask glmt, final int [] activeCols, double [] gradient){
Expand Down Expand Up @@ -1354,6 +1354,17 @@ void nextLambda(final double currentLambda, final H2OCountedCompleter cmp){

private final double l2pen(){return 0.5*_currentLambda*(1-alpha[0]);}
private final double l1pen(){return _currentLambda*alpha[0];}
private final double proxPen(double [] beta){
double [] fullBeta = expandVec(beta,_activeCols);
double res = 0;
if(_bgs != null){
for(int i = 0; i < _bgs.length; ++i){
double diff = fullBeta[i] - _bgs[i];
res += .5*_rho[i]*diff*diff;
}
}
return res;
}

// // filter the current active columns using the strong rules
// // note: strong rules are update so tha they keep all previous coefficients in, to prevent issues with line-search
Expand Down

0 comments on commit d8605e7

Please sign in to comment.