shogun
shogun copied to clipboard
auto dispatch create methods in python
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
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..