Skip to content

Commit 7a90d6e

Browse files
committed
Update lbfgs.h
fix bug
1 parent 9d867b2 commit 7a90d6e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

admm/include/lbfgs.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,19 @@ class LBFGSSolver : public Learner {
319319
return 1. / (1. + exp(-inx));
320320
}
321321

322-
inline float PredToGrad(const Eigen::VectorXf & old_w,
322+
float PredIns(const dmlc::Row<unsigned> &v,
323+
const Eigen::VectorXf &old_w){
324+
float inner = 0.0;
325+
for(unsigned int i = 0; i < v.length;++i)
326+
{
327+
if(v.index[i] > num_fea)
328+
continue;
329+
inner += old_w[v.index[i]] * v.get_value(i);
330+
}
331+
return Sigmoid(inner);
332+
}
333+
334+
inline float PredToGrad(const Eigen::VectorXf &old_w,
323335
const dmlc::Row<unsigned> &v)
324336
{
325337
return PredIns(v, old_w) - v.get_label();

0 commit comments

Comments
 (0)