Changeset 116
- Timestamp:
- Jul 19, 2004, 4:40:11 PM (19 years ago)
- Location:
- trunk/test
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Makefile.am
r93 r116 3 3 ## $Id$ 4 4 5 check_PROGRAMS = test_kernel test_merge test_pca test_rnd test_roc \ 6 test_svd test_svm test_wead 5 check_PROGRAMS = test_crossvalidation test_kernel test_merge test_pca test_rnd test_roc \ 6 test_statistics test_svd test_svm test_wead 7 8 test_crossvalidation_SOURCES = test_crossvalidation.cc 9 test_crossvalidation_LDADD = @top_srcdir@/$(CPP_TOOLS_LIB_LOCATION)/$(CPP_TOOLS_LIB) \ 10 $(GSL_LIB) $(CBLAS_LIB) $(MATH_LIB) 7 11 8 12 test_kernel_SOURCES = test_kernel.cc … … 26 30 $(GSL_LIB) $(CBLAS_LIB) $(MATH_LIB) 27 31 32 test_statistics_SOURCES = test_statistics.cc 33 test_statistics_LDADD = @top_srcdir@/$(CPP_TOOLS_LIB_LOCATION)/$(CPP_TOOLS_LIB) \ 34 $(GSL_LIB) $(CBLAS_LIB) $(MATH_LIB) 35 28 36 test_svd_SOURCES = test_svd.cc 29 37 test_svd_LDADD = @top_srcdir@/$(CPP_TOOLS_LIB_LOCATION)/$(CPP_TOOLS_LIB) \ -
trunk/test/test_svm.cc
r73 r116 20 20 21 21 { 22 cout << "reading data/nm_kernel.txt" << endl;23 22 ifstream is("data/nm_kernel.txt"); 24 23 theplu::gslapi::matrix kernel(is); 25 24 is.close(); 26 27 25 theplu::gslapi::matrix k(kernel); 28 26 29 cout << "reading data/nm_target_bin.txt" << endl;30 27 is.open("data/nm_target_bin.txt"); 31 28 theplu::gslapi::vector target(is); 32 29 is.close(); 33 30 34 cout << "reading data/nm_alpha_linear_matlab.txt" << endl;35 31 is.open("data/nm_alpha_linear_matlab.txt"); 36 32 theplu::gslapi::vector alpha_matlab(is); … … 38 34 39 35 40 cout << "create svm" << endl;41 36 theplu::cpptools::SVM svm(kernel, target); 42 cout << "train" << endl;43 37 svm.train(); 44 cout << "get alpha" << endl; 38 45 39 theplu::gslapi::vector alpha = svm.get_alpha(); 46 40 47 41 // Comparing alpha to alpha_matlab 48 42 theplu::gslapi::vector diff_alpha = alpha - alpha_matlab; 49 cout << diff_alpha*diff_alpha << endl; 50 43 if (diff_alpha*diff_alpha> pow(10.0,-10)){ 44 cerr << "Difference to matlab alphas too large/n"; 45 return -1; 46 } 51 47 // Comparing output to target 52 48 theplu::gslapi::vector output = svm.get_output(); … … 57 53 } 58 54 } 59 cout << "slack:" << slack << endl; 60 55 if (slack > pow(10.0,-10)){ 56 cerr << "Difference to matlab alphas too large/n"; 57 return -1; 58 } 61 59 return 0; 60 62 61 }
Note: See TracChangeset
for help on using the changeset viewer.