Advertisement
Guest User

Untitled

a guest
Apr 25th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1.  
  2. shogun::CFeatures* simple_generate_features(int dim_features, int num_vec) {
  3. shogun::SGMatrix<float64_t> M(dim_features, num_vec);
  4. for (int i = 0; i< dim_features; ++i) {
  5. for (int j = 0; j< num_vec; ++j) {
  6. M(i,j) = (std::pow(j + 0.0, 1.3) + i + j)/10;
  7. }
  8. }
  9.  
  10. ShowshogunMatrix( M);
  11. return new shogun::CDenseFeatures<float64_t>(M);
  12. }
  13.  
  14. void test_kernel() {
  15. shogun::CKernel* kernel = new CGaussianKernel();
  16. CFeatures* p_features = simple_generate_features(5,11);
  17. CFeatures* p_features1 = simple_generate_features(5,11);
  18. kernel->init(p_features, p_features1);
  19. kernel->cleanup();
  20. kernel->init(p_features, p_features1);
  21. kernel->cleanup();
  22. }
  23.  
  24. int main() {
  25. init_shogun_with_defaults();
  26. //testpackage();
  27. CFeatures* p_features = simple_generate_features(5,11);
  28. //test_tapkee_kpca(p_features);
  29. std::cout<<"======================="<<std::endl;
  30. //display_CDenseFeatures((CDenseFeatures<float64_t>*)p_features);
  31. // testKPCA(p_features);
  32. test_kernel();
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement