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

Multiple output var support #59

Merged
merged 11 commits into from Aug 7, 2021
Merged

Conversation

akapet00
Copy link
Member

@akapet00 akapet00 commented Aug 7, 2021

Resolves #53.

This PR introduces slight changes in API: instead of providing list of functions that will be used to extract relevant features from the simulated traces, the dictionary should be provided instead. Keys should be names of output variables as defined in the model equations, while values should be lists (with the same number of elements) where each element of the list is callable that returns a summary feature.
So instead of:

inferencer = Inferencer(dt=dt, model=eqs,
                        input={'I': inp_traces*amp},
                        output={'v': out_traces*mV},
                        features=[lambda x: x[(t > 5) & (t < 10)].mean(),
                                  lambda x: x[(t > 5) & (t < 10)].std(),
                                  lambda x: x.max()],
                        method='exponential_euler',
                        threshold='m > 0.5',
                        refractory='m > 0.5',
                        param_init={'v': 'VT'})

goes:

inferencer = Inferencer(dt=dt, model=eqs,
                        input={'I': inp_traces*amp},
                        output={'v': out_traces*mV},
                        features={'v': [lambda x: x[(t > 5) & (t < 10)].mean(),
                                        lambda x: x[(t > 5) & (t < 10)].std(),
                                        lambda x: x.max()]},
                        method='exponential_euler',
                        threshold='m > 0.5',
                        refractory='m > 0.5',
                        param_init={'v': 'VT'})

This enables the user to simultaneously infer unknown parameters from different output variables.

Additional updates:

  • docstrings typos are fixed;
  • the relevant examples are aligned with the changes in the API ;
  • default level value in some function in Inferencer are now changed, so the user should not have to worry about namespaces even when using a flexible interface, i.e., when using infer_step method manually.

Copy link
Member

@mstimberg mstimberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot test things in detail right now, but just from looking at the code, everything looks good to me 👍 I'll go ahead with the merge, if there are still details to iron out, we can do this later.

@mstimberg mstimberg merged commit a9da86c into sbi_support Aug 7, 2021
@mstimberg mstimberg deleted the multiple_output_var_support branch August 7, 2021 20:45
@akapet00
Copy link
Member Author

akapet00 commented Aug 7, 2021

Awesome, thanks.

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

Successfully merging this pull request may close these issues.

None yet

2 participants