Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include <shogun/base/init.h>
  2. #include <shogun/util/factory.h>
  3. #include <iostream>
  4.  
  5. using namespace shogun;
  6.  
  7. int main() {
  8.  
  9. init_shogun_with_defaults();
  10.  
  11. auto k = wrap(kernel("GaussianKernel"));
  12.  
  13. float64_t val = 2.0;
  14. auto a = AnyParameter(Any(val));
  15.  
  16. auto test = k->get_parameters();
  17. auto test2 = k->get_parameters();
  18.  
  19. for (auto each = test.begin(), each1 = test2.begin();
  20. each != test.end();
  21. ++each,++each1) {
  22.  
  23. std::string name = each->first;
  24. const auto anyparam = each->second.get();
  25.  
  26. if (name.compare("log_width") == 0) {
  27.  
  28. anyparam = a;
  29. name = std::string("test");
  30.  
  31. Any any = each->second.get().get_value();
  32.  
  33. try {
  34. std::cout << each->first << ": " << any_cast<float64_t>(any) << "\n";
  35. std::cout << each1->first << ": " << any_cast<float64_t>(each1->second.get().get_value()) << "\n";
  36. std::cout << demangled_type<decltype(each->second.get())>() << "\n";
  37. }
  38. catch (TypeMismatchException &m) {
  39. std::cout << m.what() << "\n";
  40. return 0;
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement