From d611f08d3016131d8e3dc6934f9cba86facdfd58 Mon Sep 17 00:00:00 2001 From: Garry Boyer Date: Mon, 9 Apr 2007 20:24:54 +0000 Subject: [PATCH] Fixed the damn bug --- fastlib/u/garryb/svm/smo.h | 6 +++--- fastlib/u/garryb/svm/svm.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fastlib/u/garryb/svm/smo.h b/fastlib/u/garryb/svm/smo.h index 4dd2e019b7..fcb652d5c1 100644 --- a/fastlib/u/garryb/svm/smo.h +++ b/fastlib/u/garryb/svm/smo.h @@ -167,7 +167,7 @@ double SMO::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::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::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; diff --git a/fastlib/u/garryb/svm/svm.cc b/fastlib/u/garryb/svm/svm.cc index dbcd6427cb..f1f30fef41 100644 --- a/fastlib/u/garryb/svm/svm.cc +++ b/fastlib/u/garryb/svm/svm.cc @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) { } SimpleCrossValidator< SVM > 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();