Skip to content

Commit

Permalink
using proper uniform distribution instead of rand() in ranking svm, ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Benazera committed Feb 12, 2015
1 parent cb7afac commit ec78ae8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion surrogates/rankingsvm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class RankingSVM
public:
RankingSVM()
{
_udist = std::uniform_real_distribution<>(0,1);
}

~RankingSVM()
Expand Down Expand Up @@ -265,7 +266,8 @@ class RankingSVM
{
_dKij(i,j) = _K(i,j) - _K(i,j+1) - _K(i+1,j) + _K(i+1,j+1);
}
_alpha(i) = _C(i) * (0.95 + 0.05*std::rand()/(double)RAND_MAX);
double fact = _udist(_rng);
_alpha(i) = _C(i) * (0.95 + 0.05*fact);
}
#pragma omp for
for (int i=0;i<_dKij.rows();i++)
Expand Down Expand Up @@ -350,6 +352,9 @@ class RankingSVM
double _epsilon = 1.0;

TKernel _kernel; /**< kernel class. */

std::mt19937 _rng;
std::uniform_real_distribution<> _udist;
};

#endif

0 comments on commit ec78ae8

Please sign in to comment.