Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <shogun/base/init.h>
- #include <shogun/util/factory.h>
- #include <iostream>
- using namespace shogun;
- int main() {
- init_shogun_with_defaults();
- auto k = wrap(kernel("GaussianKernel"));
- float64_t val = 2.0;
- auto a = AnyParameter(Any(val));
- auto test = k->get_parameters();
- auto test2 = k->get_parameters();
- for (auto each = test.begin(), each1 = test2.begin();
- each != test.end();
- ++each,++each1) {
- std::string name = each->first;
- const auto anyparam = each->second.get();
- if (name.compare("log_width") == 0) {
- anyparam = a;
- name = std::string("test");
- Any any = each->second.get().get_value();
- try {
- std::cout << each->first << ": " << any_cast<float64_t>(any) << "\n";
- std::cout << each1->first << ": " << any_cast<float64_t>(each1->second.get().get_value()) << "\n";
- std::cout << demangled_type<decltype(each->second.get())>() << "\n";
- }
- catch (TypeMismatchException &m) {
- std::cout << m.what() << "\n";
- return 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement