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

Generalize FeatureMetric #48

Open
mstimberg opened this issue Jun 16, 2021 · 1 comment
Open

Generalize FeatureMetric #48

mstimberg opened this issue Jun 16, 2021 · 1 comment
Assignees
Milestone

Comments

@mstimberg
Copy link
Member

Currently, users can provide FeatureMetric with a list of feature names known to eFEL. In addition to that functionality, it should be possible to hand over a function instead of a name to support arbitrary feature calculations not supported by eFEL.

@akapet00
Copy link
Member

akapet00 commented Aug 7, 2021

I think we can think of this as solved.

Even though we do not provide feature extraction by using eFEL or some other library behind the scenes, the user can manually use eFEL or any other external library of choice to extract features.

See for example this simple code snippet:

dt = ...
eqs = ...
inferencer = Inferencer(dt=dt, model=eqs,
                        input=...,
                        output=...,
                        features={'v': [lambda x: x.mean(),
                                        lambda x: x.std(),
                                        lambda x: x.max()]},
                        method=...,
                        threshold=...,
                        refractory=...,
                        param_init=...)

what the user could do is to define additional function that will use any external library.
Let's say that, for whatever the reason is, the potentially interesting feature to learn the posterior could be the sample entropy.
The user would just have to import the library of choice that is able to compute this and wrap it inside the callable as follows:
(Here I use antropy because of its user friendliness)

import antropy as ant

...

sample_entropy(x):
    return ant.sample_entropy(x)

...

dt = ...
eqs = ...
inferencer = Inferencer(dt=dt, model=eqs,
                        input=...,
                        output=...,
                        features={'v': [lambda x: x.mean(),
                                        lambda x: x.std(),
                                        lambda x: x.max()],
                                        sample_entropy},
                        method=...,
                        threshold=...,
                        refractory=...,
                        param_init=...)

@akapet00 akapet00 moved this from To do to Review in progress in sbi integration (GSoC 2021) Aug 7, 2021
@mstimberg mstimberg added this to the next_release milestone Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants