Skip to content

Commit

Permalink
Bug fix in glm to protect againts (throw IAE) user supplying beta_giv…
Browse files Browse the repository at this point in the history
…en but no vector of penalties in the beta_constraints.
  • Loading branch information
tomasnykodym committed Mar 2, 2015
1 parent 8d6764a commit 8e0e383
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/hex/glm/GLM2.java
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ private double computeIntercept(DataInfo dinfo, double ymu, Vec offset, Vec resp
}
if((v = beta_constraints.vec("rho")) != null)
_rho = map == null?Utils.asDoubles(v):mapVec(Utils.asDoubles(v),makeAry(names.length,0),map);
else if(_bgs != null)
throw new IllegalArgumentException("Missing vector of penalties (rho) in beta_constraints file.");
}
if (non_negative) { // make srue lb is >= 0
if (_lbs == null)
Expand Down Expand Up @@ -1357,7 +1359,7 @@ void nextLambda(final double currentLambda, final H2OCountedCompleter cmp){
private final double proxPen(double [] beta){
double [] fullBeta = expandVec(beta,_activeCols);
double res = 0;
if(_bgs != null){
if(_bgs != null && _rho != null) {
for(int i = 0; i < _bgs.length; ++i){
double diff = fullBeta[i] - _bgs[i];
res += .5*_rho[i]*diff*diff;
Expand Down

0 comments on commit 8e0e383

Please sign in to comment.