Changeset 453


Ignore:
Timestamp:
Dec 15, 2005, 10:49:23 PM (16 years ago)
Author:
Peter
Message:

changed namespace svm to classifier in test

Location:
trunk/test
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/consensus_inputranker_test.cc

    r301 r453  
    33// C++ tools include
    44////////////////////
    5 #include <c++_tools/svm/ConsensusInputRanker.h>
     5#include <c++_tools/classifier/ConsensusInputRanker.h>
    66#include <c++_tools/statistics/ROC.h>
    77#include <c++_tools/gslapi/matrix.h>
     
    2525
    2626  theplu::statistics::ROC roc;
    27   theplu::svm::ConsensusInputRanker cir(data,target,roc,10,3);
     27  theplu::classifier::ConsensusInputRanker cir(data,target,roc,10,3);
    2828
    2929  if (cir.id(0)!=2 || cir.id(1)!=0 || cir.id(2)!=1){
     
    3838
    3939  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);
    4141
    4242  if (cir2.id(0)!=2 || cir2.id(1)!=0 || cir2.id(2)!=1){
  • trunk/test/crossvalidation_test.cc

    r305 r453  
    11// $Id$
    22
    3 #include <c++_tools/svm/CrossValidation.h>
     3#include <c++_tools/classifier/CrossValidation.h>
    44#include <c++_tools/gslapi/vector.h>
    55
     
    1717    target(i)=-1;
    1818
    19   svm::CrossValidation cv(target,3);
     19  classifier::CrossValidation cv(target,3);
    2020
    2121
  • trunk/test/inputranker_test.cc

    r301 r453  
    11// $Id$
    22
    3 #include <c++_tools/svm/InputRanker.h>
     3#include <c++_tools/classifier/InputRanker.h>
    44#include <c++_tools/statistics/ROC.h>
    55#include <c++_tools/gslapi/matrix.h>
     
    2222
    2323  statistics::ROC roc;
    24   svm::InputRanker ir(data,target,roc);
     24  classifier::InputRanker ir(data,target,roc);
    2525
    2626  if (ir.id(0)!=2 || ir.id(1)!=0 || ir.id(2)!=1){
  • trunk/test/kernel_test.cc

    r446 r453  
    66#include <c++_tools/gslapi/matrix.h>
    77#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>
    1414
    1515#include <cmath>
     
    2121using namespace theplu;
    2222
    23 bool test_MEV(const gslapi::matrix& data, const svm::KernelFunction* kf,
     23bool test_MEV(const gslapi::matrix& data, const classifier::KernelFunction* kf,
    2424              const gslapi::matrix& control, const double error_bound)
    2525{
    26   svm::Kernel_MEV kernel(data,*kf);
     26  classifier::Kernel_MEV kernel(data,*kf);
    2727  for(u_int i=0;i<control.rows();i++)
    2828    for(u_int j=0;j<control.columns();j++)
     
    3535  index[1]=2;
    3636  index[2]=3;
    37   svm::KernelView(kernel,index);
     37  classifier::KernelView(kernel,index);
    3838
    3939  return true;
    4040}
    4141
    42 bool test_SEV(const gslapi::matrix& data, const svm::KernelFunction* kf,
     42bool test_SEV(const gslapi::matrix& data, const classifier::KernelFunction* kf,
    4343              const gslapi::matrix& control, const double error_bound)
    4444{
    45   svm::Kernel_SEV kernel(data,*kf);
     45  classifier::Kernel_SEV kernel(data,*kf);
    4646  for(u_int i=0;i<control.rows();i++)
    4747    for(u_int j=0;j<control.columns();j++)
     
    5454  index[1]=2;
    5555  index[2]=3;
    56   svm::KernelView(kernel,index);
     56  classifier::KernelView(kernel,index);
    5757  return true;
    5858}
     
    8484  gslapi::matrix kernel_matlab(is);
    8585  is.close();
    86   svm::KernelFunction* kf = new svm::PolynomialKernelFunction();
     86  classifier::KernelFunction* kf = new classifier::PolynomialKernelFunction();
    8787  ok = (ok && test_MEV(data,kf,kernel_matlab,error_bound)
    8888        & test_SEV(data,kf,kernel_matlab,error_bound));
     
    9292  gslapi::matrix kernel_matlab2(is);
    9393  is.close();
    94   kf = new svm::PolynomialKernelFunction(2);
     94  kf = new classifier::PolynomialKernelFunction(2);
    9595  ok = (ok && test_MEV(data,kf,kernel_matlab2,error_bound)
    9696        & test_SEV(data,kf,kernel_matlab2,error_bound));
     
    9999  // Checking that a GaussianKernelFunction object can be built at
    100100  // compile time.
    101   kf = new svm::GaussianKernelFunction();
     101  kf = new classifier::GaussianKernelFunction();
    102102  delete kf;
    103103
  • trunk/test/svm_test.cc

    r442 r453  
    33#include <c++_tools/gslapi/matrix.h>
    44#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>
    1010
    1111#include <cassert>
     
    3434  target2(1)=1;
    3535  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);
    3838  assert(kernel2.size()==3);
    39   svm::SVM svm2(kernel2, target2);
    40   svm2.train();
     39  classifier::SVM classifier2(kernel2, target2);
     40  classifier2.train();
    4141
    42   if (svm2.alpha()*target2){
     42  if (classifier2.alpha()*target2){
    4343    std::cerr << "condition not fullfilled" << std::endl;
    4444    return -1;
    4545  }
    4646
    47   if (svm2.alpha()(1)!=2 || svm2.alpha()(2)!=2){
     47  if (classifier2.alpha()(1)!=2 || classifier2.alpha()(2)!=2){
    4848    std::cerr << "wrong alpha" << std::endl;
    49     std::cerr << "alpha: " << svm2.alpha() <<  std::endl;
     49    std::cerr << "alpha: " << classifier2.alpha() <<  std::endl;
    5050    std::cerr << "expected: 4 2 2" <<  std::endl;
    5151
     
    6161  gslapi::matrix data=transposed_data;
    6262
    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);
    6565
    6666
     
    7373  is.close();
    7474
    75   theplu::svm::SVM svm(kernel, target);
    76   if (!svm.train()){
     75  theplu::classifier::SVM classifier(kernel, target);
     76  if (!classifier.train()){
    7777    ok=false;
    7878    if (print)
     
    8080  }
    8181
    82   theplu::gslapi::vector alpha = svm.alpha();
     82  theplu::gslapi::vector alpha = classifier.alpha();
    8383     
    8484  // Comparing alpha to alpha_matlab
     
    9292
    9393  // Comparing output to target
    94   theplu::gslapi::vector output(svm.output());
     94  theplu::gslapi::vector output(classifier.output());
    9595  double slack = 0;
    9696  for (unsigned int i=0; i<target.size(); i++){
Note: See TracChangeset for help on using the changeset viewer.