Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto dispatch create methods in python #4998

Open
karlnapf opened this issue Apr 6, 2020 · 1 comment
Open

auto dispatch create methods in python #4998

karlnapf opened this issue Apr 6, 2020 · 1 comment

Comments

@karlnapf
Copy link
Member

karlnapf commented Apr 6, 2020

We have get for python, which automatically returns the correct type, i.e. get('my_vector') and get('my_int') return a numpy array and an int respectively.

Now, why don't we do the same thing for creating shogun objects via factories? (In Python)

create_kernel('GaussianKernel') -> create('GaussianKernel')

That should be possible using exactly the same mechanics as in get, or do I get this wrong? @gf712 Maybe you can provide pointers for a student to do this

@gf712
Copy link
Member

gf712 commented Apr 6, 2020

Hmmm, this would be more complicated, because we call get with a visitor pattern, so we have Any to visit on. What you need is a way to dispatch with sgobject to the “base” class. Will have to think about it! Otherwise there is the naive with a try except for loop in Python..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants