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

setting hyper parameters of samplers #391

Closed
martinjrobins opened this issue Jul 16, 2018 · 7 comments
Closed

setting hyper parameters of samplers #391

martinjrobins opened this issue Jul 16, 2018 · 7 comments
Assignees

Comments

@martinjrobins
Copy link
Member

After creating a pints.MCMCSampling object, how can you set the hyper parameters of the underlying method object? @MichaelClerx?

@MichaelClerx
Copy link
Member

For Optimisation we have a method optimiser(): http://pints.readthedocs.io/en/latest/optimisers/running.html#pints.Optimisation.optimiser

We should probably add the same for MCMCSampling!

@martinjrobins
Copy link
Member Author

ok cool, I'll add that

@martinjrobins martinjrobins self-assigned this Jul 16, 2018
@mirams
Copy link
Member

mirams commented Jul 16, 2018

One of my favourite Chaste coding conventions is 'Methods should be Verbs'. So maybe we should have a get_ or something in front of optimiser()?

@martinjrobins
Copy link
Member Author

martinjrobins commented Jul 16, 2018

yea, that is a reasonable convention, but probably should be a separate issue as it would involve lots of changes to apply the convention globally in pints. For the moment I'll add a method called samplers() in order to match optimiser()

@MichaelClerx
Copy link
Member

We're currently using the "I don't like typing get_ all the time" convention. It probably has a nicer name, but I'm quite a fan of that! Happy to discuss though. Maybe best to see what other Python packages do

MichaelClerx added a commit that referenced this issue Jul 16, 2018
#391 add method to MCMCSampling to access underlying samplers
@MichaelClerx
Copy link
Member

Update: Don't think it has a name. But

$ python
>>> dir(dict)
[..., 'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values', 'viewitems', 'viewkeys', 'viewvalues']

So clear, pop, and setdefault, but also items, and keys
Then again, I'd much prefer set_default, view_items etc. Python's code and standard library stuff can be a bit of a mess, naming-convention wise.

I quite like the "method-is-a-verb-except-for-get" convention, but interested to hear what other people think

@martinjrobins
Copy link
Member Author

Yea, I'm kinda in the middle on this one. I am moving gradually away from using get_ for getters due to it being overly verbose and not playing nicely with auto-complete (I have to type 4 extra characters!!!!), but the whole "method-is-always-a-verb` is a nice clear and consistent convention to follow. Let me put it this way, I don't have the motivation to change what we already have, but I'm happy to go along if someone else does ;)

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

No branches or pull requests

3 participants