Fixed the damn bug

This commit is contained in:
Garry Boyer
2007-04-09 20:24:54 +00:00
parent d945422e90
commit d611f08d30
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -167,7 +167,7 @@ double SMO<TKernel>::Evaluate_(index_t i) const {
GetVector_(j, &support_vector);
summation +=
GetLabelSign_(i)
GetLabelSign_(j)
* alpha_[j]
* kernel_.Eval(example, support_vector);
}
@@ -336,13 +336,14 @@ bool SMO<TKernel>::TakeStep_(index_t i, index_t j, double error_j) {
alpha_j = math::ClampRange(alpha_j, l, u);
} else {
DEBUG_MSG(0, "Uncommon case");
/*
//abort();
double c1 = eta/2;
double c2 = yj * (error_i - error_j) - eta * alpha_j;
double objlower = c1*l*l + c2*l;
double objupper = c1*u*u + c2*u;
/*
abort();
*/
double fiold = error_i + yi;
double fjold = error_j + yj;
double vi = fiold + thresh_ - yi*alpha_[i]*kii - yj*alpha_[j]*kij;
@@ -355,7 +356,6 @@ bool SMO<TKernel>::TakeStep_(index_t i, index_t j, double error_j) {
double objupper = fu + u
- 0.5*kii*fu*fu - 0.5*kjj*u*u
- s*kij*fu*u - yj*u*vj;
*/
if (objlower > objupper + SMO_EPS) {
alpha_j = l;
+1 -1
View File
@@ -44,7 +44,7 @@ int main(int argc, char *argv[]) {
}
SimpleCrossValidator< SVM<SVMRBFKernel> > cross_validator;
cross_validator.Init(&dataset, 2, 4, fx_root, "svm");
cross_validator.Init(&dataset, 2, 2, fx_root, "svm");
cross_validator.Run(true);
fx_done();