Changeset 453
- Timestamp:
- Dec 15, 2005, 10:49:23 PM (17 years ago)
- Location:
- trunk/test
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/consensus_inputranker_test.cc
r301 r453 3 3 // C++ tools include 4 4 //////////////////// 5 #include <c++_tools/ svm/ConsensusInputRanker.h>5 #include <c++_tools/classifier/ConsensusInputRanker.h> 6 6 #include <c++_tools/statistics/ROC.h> 7 7 #include <c++_tools/gslapi/matrix.h> … … 25 25 26 26 theplu::statistics::ROC roc; 27 theplu:: svm::ConsensusInputRanker cir(data,target,roc,10,3);27 theplu::classifier::ConsensusInputRanker cir(data,target,roc,10,3); 28 28 29 29 if (cir.id(0)!=2 || cir.id(1)!=0 || cir.id(2)!=1){ … … 38 38 39 39 theplu::gslapi::matrix flag(data.rows(),data.columns(),1); 40 theplu:: svm::ConsensusInputRanker cir2(data,target,flag,roc,10,3);40 theplu::classifier::ConsensusInputRanker cir2(data,target,flag,roc,10,3); 41 41 42 42 if (cir2.id(0)!=2 || cir2.id(1)!=0 || cir2.id(2)!=1){ -
trunk/test/crossvalidation_test.cc
r305 r453 1 1 // $Id$ 2 2 3 #include <c++_tools/ svm/CrossValidation.h>3 #include <c++_tools/classifier/CrossValidation.h> 4 4 #include <c++_tools/gslapi/vector.h> 5 5 … … 17 17 target(i)=-1; 18 18 19 svm::CrossValidation cv(target,3);19 classifier::CrossValidation cv(target,3); 20 20 21 21 -
trunk/test/inputranker_test.cc
r301 r453 1 1 // $Id$ 2 2 3 #include <c++_tools/ svm/InputRanker.h>3 #include <c++_tools/classifier/InputRanker.h> 4 4 #include <c++_tools/statistics/ROC.h> 5 5 #include <c++_tools/gslapi/matrix.h> … … 22 22 23 23 statistics::ROC roc; 24 svm::InputRanker ir(data,target,roc);24 classifier::InputRanker ir(data,target,roc); 25 25 26 26 if (ir.id(0)!=2 || ir.id(1)!=0 || ir.id(2)!=1){ -
trunk/test/kernel_test.cc
r446 r453 6 6 #include <c++_tools/gslapi/matrix.h> 7 7 #include <c++_tools/gslapi/vector.h> 8 #include <c++_tools/ svm/KernelFunction.h>9 #include <c++_tools/ svm/PolynomialKernelFunction.h>10 #include <c++_tools/ svm/GaussianKernelFunction.h>11 #include <c++_tools/ svm/KernelView.h>12 #include <c++_tools/ svm/Kernel_MEV.h>13 #include <c++_tools/ svm/Kernel_SEV.h>8 #include <c++_tools/classifier/KernelFunction.h> 9 #include <c++_tools/classifier/PolynomialKernelFunction.h> 10 #include <c++_tools/classifier/GaussianKernelFunction.h> 11 #include <c++_tools/classifier/KernelView.h> 12 #include <c++_tools/classifier/Kernel_MEV.h> 13 #include <c++_tools/classifier/Kernel_SEV.h> 14 14 15 15 #include <cmath> … … 21 21 using namespace theplu; 22 22 23 bool test_MEV(const gslapi::matrix& data, const svm::KernelFunction* kf,23 bool test_MEV(const gslapi::matrix& data, const classifier::KernelFunction* kf, 24 24 const gslapi::matrix& control, const double error_bound) 25 25 { 26 svm::Kernel_MEV kernel(data,*kf);26 classifier::Kernel_MEV kernel(data,*kf); 27 27 for(u_int i=0;i<control.rows();i++) 28 28 for(u_int j=0;j<control.columns();j++) … … 35 35 index[1]=2; 36 36 index[2]=3; 37 svm::KernelView(kernel,index);37 classifier::KernelView(kernel,index); 38 38 39 39 return true; 40 40 } 41 41 42 bool test_SEV(const gslapi::matrix& data, const svm::KernelFunction* kf,42 bool test_SEV(const gslapi::matrix& data, const classifier::KernelFunction* kf, 43 43 const gslapi::matrix& control, const double error_bound) 44 44 { 45 svm::Kernel_SEV kernel(data,*kf);45 classifier::Kernel_SEV kernel(data,*kf); 46 46 for(u_int i=0;i<control.rows();i++) 47 47 for(u_int j=0;j<control.columns();j++) … … 54 54 index[1]=2; 55 55 index[2]=3; 56 svm::KernelView(kernel,index);56 classifier::KernelView(kernel,index); 57 57 return true; 58 58 } … … 84 84 gslapi::matrix kernel_matlab(is); 85 85 is.close(); 86 svm::KernelFunction* kf = new svm::PolynomialKernelFunction();86 classifier::KernelFunction* kf = new classifier::PolynomialKernelFunction(); 87 87 ok = (ok && test_MEV(data,kf,kernel_matlab,error_bound) 88 88 & test_SEV(data,kf,kernel_matlab,error_bound)); … … 92 92 gslapi::matrix kernel_matlab2(is); 93 93 is.close(); 94 kf = new svm::PolynomialKernelFunction(2);94 kf = new classifier::PolynomialKernelFunction(2); 95 95 ok = (ok && test_MEV(data,kf,kernel_matlab2,error_bound) 96 96 & test_SEV(data,kf,kernel_matlab2,error_bound)); … … 99 99 // Checking that a GaussianKernelFunction object can be built at 100 100 // compile time. 101 kf = new svm::GaussianKernelFunction();101 kf = new classifier::GaussianKernelFunction(); 102 102 delete kf; 103 103 -
trunk/test/svm_test.cc
r442 r453 3 3 #include <c++_tools/gslapi/matrix.h> 4 4 #include <c++_tools/gslapi/vector.h> 5 #include <c++_tools/ svm/SVM.h>6 #include <c++_tools/ svm/Kernel.h>7 #include <c++_tools/ svm/Kernel_SEV.h>8 #include <c++_tools/ svm/Kernel_MEV.h>9 #include <c++_tools/ svm/PolynomialKernelFunction.h>5 #include <c++_tools/classifier/SVM.h> 6 #include <c++_tools/classifier/Kernel.h> 7 #include <c++_tools/classifier/Kernel_SEV.h> 8 #include <c++_tools/classifier/Kernel_MEV.h> 9 #include <c++_tools/classifier/PolynomialKernelFunction.h> 10 10 11 11 #include <cassert> … … 34 34 target2(1)=1; 35 35 target2(2)=1; 36 svm::KernelFunction* kf2 = new svm::PolynomialKernelFunction();37 svm::Kernel_MEV kernel2(data2,*kf2);36 classifier::KernelFunction* kf2 = new classifier::PolynomialKernelFunction(); 37 classifier::Kernel_MEV kernel2(data2,*kf2); 38 38 assert(kernel2.size()==3); 39 svm::SVM svm2(kernel2, target2);40 svm2.train();39 classifier::SVM classifier2(kernel2, target2); 40 classifier2.train(); 41 41 42 if ( svm2.alpha()*target2){42 if (classifier2.alpha()*target2){ 43 43 std::cerr << "condition not fullfilled" << std::endl; 44 44 return -1; 45 45 } 46 46 47 if ( svm2.alpha()(1)!=2 || svm2.alpha()(2)!=2){47 if (classifier2.alpha()(1)!=2 || classifier2.alpha()(2)!=2){ 48 48 std::cerr << "wrong alpha" << std::endl; 49 std::cerr << "alpha: " << svm2.alpha() << std::endl;49 std::cerr << "alpha: " << classifier2.alpha() << std::endl; 50 50 std::cerr << "expected: 4 2 2" << std::endl; 51 51 … … 61 61 gslapi::matrix data=transposed_data; 62 62 63 svm::KernelFunction* kf = new svm::PolynomialKernelFunction();64 svm::Kernel_SEV kernel(data,*kf);63 classifier::KernelFunction* kf = new classifier::PolynomialKernelFunction(); 64 classifier::Kernel_SEV kernel(data,*kf); 65 65 66 66 … … 73 73 is.close(); 74 74 75 theplu:: svm::SVM svm(kernel, target);76 if (! svm.train()){75 theplu::classifier::SVM classifier(kernel, target); 76 if (!classifier.train()){ 77 77 ok=false; 78 78 if (print) … … 80 80 } 81 81 82 theplu::gslapi::vector alpha = svm.alpha();82 theplu::gslapi::vector alpha = classifier.alpha(); 83 83 84 84 // Comparing alpha to alpha_matlab … … 92 92 93 93 // Comparing output to target 94 theplu::gslapi::vector output( svm.output());94 theplu::gslapi::vector output(classifier.output()); 95 95 double slack = 0; 96 96 for (unsigned int i=0; i<target.size(); i++){
Note: See TracChangeset
for help on using the changeset viewer.