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

Bugfix basis properties #241

Merged
merged 118 commits into from
Oct 7, 2024
Merged

Bugfix basis properties #241

merged 118 commits into from
Oct 7, 2024

Conversation

BalzaniEdoardo
Copy link
Collaborator

Added tests to check setters for basis properties. Properties that can be set (using the set_parames) are those one that may be used in cross-validation. In particular, the following parameters should be settable

Shared by all basis:

  1. n_basis_funcs
  2. window_size (only in "conv" mode)
  3. bounds (only in "eval" mode)

SplineBasis:

  1. order

RaisedCosine:

  1. width

RaisedCosineLog:

  1. time_scaling
  2. enforce_decay_to_zero

OrthExponentialBasis:

  1. decay_rates

The mode parameter will be read-only, since most commonly, only one mode of operation will make sense for a specific variable (spike counts input will require mode="conv" for example); It will still be possible to cross-validate over different mode of operation by directly cross-validating different basis,

# define a pipeline
pipeline = Pipeline(
    [
        (
            "transformerbasis",
            nmo.basis.TransformerBasis(nmo.basis.RaisedCosineBasisLinear(6)),
        ),
        (
            "glm",
            nmo.glm.GLM(regularizer_strength=0.5, regularizer="Ridge"),
        ),
    ]
)


# define a parameter grid with the basis in the two mode of operation
param_grid = dict(
    transformerbasis___basis=(
        nmo.basis.RaisedCosineBasisLinear(5, mode="conv"),
        nmo.basis.RaisedCosineBasisLinear(5, mode="eval")),
    ),
)

@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 94.23077% with 3 lines in your changes missing coverage. Please review.

Project coverage is 97.29%. Comparing base (6dcd891) to head (31de724).
Report is 126 commits behind head on main.

Files with missing lines Patch % Lines
src/nemos/basis.py 94.11% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #241      +/-   ##
==========================================
+ Coverage   97.24%   97.29%   +0.05%     
==========================================
  Files          20       20              
  Lines        1815     1849      +34     
==========================================
+ Hits         1765     1799      +34     
  Misses         50       50              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BalzaniEdoardo BalzaniEdoardo merged commit 88c48d9 into main Oct 7, 2024
12 checks passed
BalzaniEdoardo added a commit that referenced this pull request Oct 7, 2024
…roperties"

This reverts commit 88c48d9, reversing
changes made to 79fcfab.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants