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

Add kwargs style factories in Python #4461

Closed
karlnapf opened this issue Jan 13, 2019 · 6 comments
Closed

Add kwargs style factories in Python #4461

karlnapf opened this issue Jan 13, 2019 · 6 comments
Assignees

Comments

@karlnapf
Copy link
Member

No description provided.

@karlnapf karlnapf created this issue from a note in Release 7.0.0 (To do) Jan 13, 2019
@karlnapf
Copy link
Member Author

See discussion at the bottom of #4441

@gf712 gf712 moved this from To do to In progress in Release 7.0.0 Jan 14, 2019
@gf712 gf712 moved this from In progress to Done in Release 7.0.0 Jan 14, 2019
@gf712 gf712 moved this from Done to In progress in Release 7.0.0 Jan 14, 2019
@karlnapf
Copy link
Member Author

@sorig Check it out we now have shogun API for my_kernel = sg.kernel("GaussianKernel", log_width=1.0). One thing that would be really awesome was if the meta language examples would make use of this. Currently, it is not possible to modify say python.json in order to produce the correct output. E.g.

        "KeywordArguments": {
            "List": ", $elements",
            "Element": "$keyword = $expr",
            "Separator": ", ",
            "InitialSeperatorWhenArgs>0": false
        },

produces things like

svm = machine("LibSVM"), C1 = 1.1, kernel = k

Any change you could also have a quick hack on that?

Obviously, for the other langs, we don't want to change things (i.e. still go with the put cascades for now).

@gf712
Copy link
Member

gf712 commented Jan 14, 2019

Maybe could add a hardcoded list of keywords to ignore?
I was thinking maybe with a comment in front of the statement in the .sg file (e.g. //ignore_kwargs:python), but that would probably make it harder to implement and probably more tedious to maintain?

@karlnapf
Copy link
Member Author

I think this is a simple matter of changing the generator a bit so that it can generate the python style kwargs .... let's see what esben makes of it :)

@sorig
Copy link
Member

sorig commented Jan 15, 2019

A cool! I think we actually anticipated this change when doing kwargs. I documented how to do it in the original PR #4128

I think the approach documented there still works :)

@karlnapf
Copy link
Member Author

Cool stuff, I should have thought that you did that :) thanks!

@gf712 gf712 moved this from In progress to Done in Release 7.0.0 Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Release 7.0.0
  
Done
Development

No branches or pull requests

3 participants