Changeset 127


Ignore:
Timestamp:
Aug 3, 2004, 11:36:41 AM (17 years ago)
Author:
Peter
Message:

test_vector added

Location:
trunk/test
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Makefile.am

    r116 r127  
    44
    55check_PROGRAMS = test_crossvalidation test_kernel test_merge test_pca test_rnd test_roc \
    6      test_statistics test_svd test_svm test_wead
     6     test_statistics test_svd test_svm test_vector test_wead
    77
    88test_crossvalidation_SOURCES = test_crossvalidation.cc
     
    4242    $(GSL_LIB) $(CBLAS_LIB) $(MATH_LIB)
    4343
     44test_vector_SOURCES = test_vector.cc
     45test_vector_LDADD = @top_srcdir@/$(CPP_TOOLS_LIB_LOCATION)/$(CPP_TOOLS_LIB) \
     46    $(GSL_LIB) $(CBLAS_LIB) $(MATH_LIB)
     47
    4448test_wead_SOURCES = test_wead.cc
    4549test_wead_LDADD = @top_srcdir@/$(CPP_TOOLS_LIB_LOCATION)/$(CPP_TOOLS_LIB) \
  • trunk/test/test_svm.cc

    r116 r127  
    2121
    2222  ifstream is("data/nm_kernel.txt");
    23   theplu::gslapi::matrix kernel(is);
     23  theplu::gslapi::matrix kernel_matrix(is);
    2424  is.close();
    25   theplu::gslapi::matrix k(kernel);
    2625 
    2726  is.open("data/nm_target_bin.txt");
     
    3332  is.close();
    3433
    35 
    36   theplu::cpptools::SVM svm(kernel, target);
     34  theplu::cpptools::SVM svm(kernel_matrix, target);
    3735  svm.train();
    3836
     
    5755    return -1;
    5856  }
     57
     58  // testing on XOR problem
     59  cout << "testing XOR\n";
     60  theplu::gslapi::matrix data(4,2);
     61  data(0,0)=1;
     62  data(0,1)=1;
     63 
     64  data(1,0)=1;
     65  data(1,1)=-1;
     66 
     67  data(2,0)=-1;
     68  data(2,1)=1;
     69 
     70  data(3,0)=-1;
     71  data(3,1)=-1;
     72 
     73  target = theplu::gslapi::vector(4,1.0);
     74  target(1)=-1;
     75  target(2)=-1;
     76 
     77  theplu::cpptools::KernelFunction* kf =
     78    new theplu::cpptools::PolynomialKernelFunction();
     79  theplu::cpptools::Kernel kernel(data,*kf);
     80  svm = theplu::cpptools::SVM(kernel.get(),target);
     81  //  svm.train();
     82  cout << kernel.get() << "\n";
    5983  return 0;
    6084 
Note: See TracChangeset for help on using the changeset viewer.