-
Notifications
You must be signed in to change notification settings - Fork 369
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
WIP: CNMFParams overhaul #1239
WIP: CNMFParams overhaul #1239
Conversation
…setting unintended fields. No longer returns another reference to CNMFParams
It seems like a good idea generally: I'm not sure what is breaking about this exactly? How would the parameter object be initialized differently? How would |
Right now (pre-this-patch) there are three inputs into CNMFParams: Example of B:
This diff, relating to those three inputs: Example of B, post-patch:
It's a breaking change because existing code that doesn't go purely through route A will need to be updated to build/update a params object differently. Post-patch, the pre-patch way of doing B will not work anymore. |
Nice work Pat! Am all for for deprecating the initialization using named parameters, same holds when initializing the CNMF object #1085. |
@j-friedrich If it needs to be consistent between the three, we should just have it be a single parameter somewhere? No sense even having 3 separate parameters if there's the possibility of them getting out of sync |
Yes I'd be wary of a breaking change especially initially. Some of these categories are sort of confusing and I like the current method of just sending in a bunch of parameters without having to categorize (or think too much about) why some are in But definitely the concern of having the same parameter in different categories should be addressed. |
Based on discussion: We should look into revising the parameters themselves when they don't make sense (particularly the Hoping that sounds reasonable. |
I'd be wary of even adding warnings etc. Let people use the legacy api for as long as they want as long as it doesn't introduce bugs (and if we get rid of duplicate names etc that should be doable right?). In the meantime, in our demos and docs etc we'll use the new interface (mention the legacy api in the docs but not the updated demos). I actually sort of like the "flat" interface as it is simple, convenient, and mimics the |
We want to deprecate the old way of doing things; the warnings are needed to give people notice so we can eventually have better, simpler code. Leaving old ways of doing things in forever just makes code more bulky and harder to maintain. The legacy api needs to go eventually (both of them, really). |
Hm, I'd also be fine with keeping the flat params_dict. What was the bug that led Pat down that rabbit hole in the first place? Not sure what's best, keep the flat params_dict and the grouped params object, or make them both flat, or both grouped. Agree with not maintaining too many options for too long. |
The thing that led me down this route was that (after that, I spotted the inability to set some parameters separately, the reuse of parameter names, and the general messiness of the setting code) Having a subset for shared paramters makes sense to me. Going all-in on groups (API and internally) will help us reason about the code, particularly once we get past the transition period; it'll act like variable scopes (flattening things would be the equivalent to making everything global, and is in my view very undesirable) |
Then I'd just leave it as is then. Flat is better than nested. I don't see a need to make a breaking change like this if the bugs can be ironed out without it. The groupings are convenient for passing things around, but doesn't need to be forced on users. As it is now, we can expose it to them as needed, but when initializing it seems like an unnecessary complexity. |
I think the choice comes down to flattening it internally and externally, or going whole-hog on the structure. The status quo of having it being structured internally but flat externally makes for ugly code and bugs. Right now I'm intending to go with the plan I outlined above unless a good reason turns up to change that. |
…internally implement set()
…ists in set method as deprecated
Having marinated with this for a while, it seems the flat structure is a good feature for a few reasons -- primarily zen of Python 'flat is better than nested type reasons' -- flat is easier to read and understand and type. More specifically, I don't like the idea of forcing users to adhere to a structured dictionary of parameters when creating params and
The reasons for wanting the change (e.g., the issue I raised #1153 ) can be solved by simply adhering to the intent of the parameters object, and not having name clashes. This should be easy enough to fix. |
This is a breaking change that fixes crucial bugs with CNMFParams, and it also adds json loading/saving functions for the same.
Before this lands:
A) All the demos need to be adjusted too
B) We need to do some outreach because this is a breaking change that will be painful for users
C) I need to look into whether the set() method needs similar adjustments
D) Consider making change_params() and set() if we change it validate its inputs and complain if it is passed parameters that it doesn't know how to set (right now these are just ignored). Ideally gate this behind a validate:bool argument or something like that