Changeset 1672
- Timestamp:
- Dec 22, 2008, 2:27:20 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/svm_test.cc
r1487 r1672 92 92 } 93 93 94 // tol defined on learning precision 94 95 double tol=1e-6; 95 if ( std::abs(classifier2.alpha()(1)-2)>tol ||96 std::abs(classifier2.alpha()(2)-2)>tol){96 if (!suite.equal_fix(classifier2.alpha()(1), 2.0, tol) || 97 !suite.equal_fix(classifier2.alpha()(2), 2.0, tol) ) { 97 98 suite.err() << "wrong alpha" << std::endl; 98 99 suite.err() << "alpha: " << classifier2.alpha() << std::endl; … … 129 130 130 131 // Comparing alpha to alpha_matlab 131 theplu::yat::utility::Vector diff_alpha(alpha); 132 diff_alpha-=alpha_matlab; 133 if (!(diff_alpha*diff_alpha<1e-10) ){ 132 if (!suite.equal_range_fix(alpha.begin(), alpha.end(), 133 alpha_matlab.begin(), 1e-6) ) { 134 134 suite.err() << "Difference to matlab alphas too large\n"; 135 135 suite.add(false); 136 136 } 137 137 138 138 139 // Comparing output to target … … 142 143 if (output(i)*target(i) < 1){ 143 144 if (target.binary(i)) 144 slack += 1 - output(i);145 slack = 1 - output(i); 145 146 else 146 slack += 1 + output(i); 147 slack = 1 + output(i); 148 double slack_bound=2e-7; 149 if (slack > slack_bound || std::isnan(slack)){ 150 suite.err() << "Slack too large. Is the bias correct?\n"; 151 suite.err() << "slack: " << slack << std::endl; 152 suite.err() << "expected less than " << slack_bound << std::endl; 153 suite.add(false); 154 } 147 155 } 148 }149 double slack_bound=2e-7;150 if (slack > slack_bound || std::isnan(slack)){151 suite.err() << "Slack too large. Is the bias correct?\n";152 suite.err() << "slack: " << slack << std::endl;153 suite.err() << "expected less than " << slack_bound << std::endl;154 suite.add(false);155 156 } 156 157
Note: See TracChangeset
for help on using the changeset viewer.