Skip to content

Commit 1f57b30

Browse files
authored
Merge branch 'main' into aistats2025
2 parents e54c0d1 + aa0db43 commit 1f57b30

File tree

12 files changed

+157
-70
lines changed

12 files changed

+157
-70
lines changed

.github/workflows/docs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
- main
1010
- public
1111
- dev
12+
paths:
13+
- '**.py'
14+
- '**.ipynb'
15+
- '**.js'
16+
- '**.rst'
17+
- '**.md'
1218

1319
jobs:
1420
build:
@@ -69,6 +75,7 @@ jobs:
6975
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
7076
pip install '.[docs]'
7177
78+
7279
- name: Build docs
7380
run: |
7481
ls docs/source/cebra-figures

AUTHORS.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<img src="https://github.com/user-attachments/assets/1f327e57-8ee1-4a2f-afd3-2bbce885c2f8" width="200"/>
2+
3+
4+
5+
CEBRA was initially developed by **Mackenzie Mathis** and **Steffen Schneider** (2021+), who are co-inventors on the patent application [WO2023143843](https://infoscience.epfl.ch/entities/patent/0d9debed-4d22-47b7-bad1-f211e7010323).
6+
**Jin Hwa Lee** contributed significantly to our first paper:
7+
8+
> **Schneider, S., Lee, J.H., & Mathis, M.W.**
9+
> [*Learnable latent embeddings for joint behavioural and neural analysis.*](https://doi.org/10.1038/s41586-023-06031-6)
10+
> Nature 617, 360–368 (2023)
11+
12+
CEBRA is actively developed by [**Mackenzie Mathis**](https://www.mackenziemathislab.org/) and [**Steffen Schneider**](https://dynamical-inference.ai/) and their labs.
13+
14+
It is a publicly available tool that has benefited from contributions and suggestions from many individuals: [CEBRA/graphs/contributors](https://github.com/AdaptiveMotorControlLab/CEBRA/graphs/contributors).
15+
16+
## CEBRA Extensions
17+
18+
### 2023
19+
- **Steffen Schneider, Rodrigo González Laiz, Markus Frey, Mackenzie W. Mathis**
20+
[*Identifiable attribution maps using regularized contrastive learning.*](https://sslneurips23.github.io/paper_pdfs/paper_80.pdf)
21+
NeurIPS 4th Workshop on Self-Supervised Learning: Theory and Practice (2023)
22+
23+
### 2025
24+
- **Steffen Schneider, Rodrigo González Laiz, Anastasiia Filippova, Markus Frey, Mackenzie W. Mathis**
25+
[*Time-series attribution maps with regularized contrastive learning.*](https://openreview.net/forum?id=aGrCXoTB4P)
26+
AISTATS (2025)
27+
28+

cebra/integrations/plotly.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import numpy.typing as npt
2929
import plotly.graph_objects
3030
import torch
31+
import plotly.graph_objects as go
3132

3233
from cebra.integrations.matplotlib import _EmbeddingPlot
3334

@@ -154,7 +155,7 @@ def _plot_3d(self, **kwargs) -> plotly.graph_objects.Figure:
154155
def plot_embedding_interactive(
155156
embedding: Union[npt.NDArray, torch.Tensor],
156157
embedding_labels: Optional[Union[npt.NDArray, torch.Tensor, str]] = "grey",
157-
axis: Optional[plotly.graph_objects.Figure] = None,
158+
axis: Optional["go.Figure"] = None,
158159
markersize: float = 1,
159160
idx_order: Optional[Tuple[int]] = None,
160161
alpha: float = 0.4,
@@ -163,7 +164,7 @@ def plot_embedding_interactive(
163164
figsize: Tuple[int] = (5, 5),
164165
dpi: int = 100,
165166
**kwargs,
166-
) -> plotly.graph_objects.Figure:
167+
) -> "go.Figure":
167168
"""Plot embedding in a 3D dimensional space.
168169
169170
This is supposing that the dimensions provided to ``idx_order`` are in the range of the number of

docs/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ help:
1818
html:
1919
PYTHONPATH=.. $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2020

21+
# Build multiple versions
22+
html_versions:
23+
for v in latest v0.2.0 v0.3.0 v0.4.0; do \
24+
PYTHONPATH=.. $(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)/$$v"; \
25+
done
2126
# Remove the current temp folder and page build
2227
clean:
2328
rm -rf build

docs/source/_static/css/custom.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
requirejs.config({
2+
paths: {
3+
base: '/static/base',
4+
plotly: 'https://cdn.plot.ly/plotly-2.12.1.min.js?noext',
5+
},
6+
});

docs/source/_templates/layout.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{% extends "pydata_sphinx_theme/layout.html" %}
22

3-
{% block fonts %}
3+
{% block extrahead %}
4+
<!-- Load require.js locally from _static -->
5+
<script src="{{ pathto('_static/css/custom.js', 1) }}"></script>
6+
7+
{% endblock %}
48

9+
{% block fonts %}
510
<link rel="preconnect" href="https://fonts.googleapis.com">
611
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
712
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300&display=swap" rel="stylesheet">
8-
913
{% endblock %}
1014

1115
{% block docs_sidebar %}

docs/source/conf.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def get_years(start_year=2021):
4747

4848
# -- Project information -----------------------------------------------------
4949
project = "cebra"
50-
copyright = f"""{get_years(2021)}, Steffen Schneider, Jin H Lee, Mackenzie Mathis"""
51-
author = "Steffen Schneider, Jin H Lee, Mackenzie Mathis"
50+
copyright = f"""{get_years(2021)}"""
51+
author = "See AUTHORS.md"
5252
# The full version, including alpha/beta/rc tags
5353
release = cebra.__version__
5454

@@ -57,6 +57,13 @@ def get_years(start_year=2021):
5757
# Add any Sphinx extension module names here, as strings. They can be
5858
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
5959
# ones.
60+
61+
#https://github.com/spatialaudio/nbsphinx/issues/128#issuecomment-1158712159
62+
html_js_files = [
63+
"require.min.js", # Add to your _static
64+
"custom.js",
65+
]
66+
6067
extensions = [
6168
"sphinx.ext.autodoc",
6269
"sphinx.ext.napoleon",
@@ -68,13 +75,13 @@ def get_years(start_year=2021):
6875
"sphinx_tabs.tabs",
6976
"sphinx.ext.mathjax",
7077
"IPython.sphinxext.ipython_console_highlighting",
71-
# "sphinx_panels", # Note: package to avoid: no longer maintained.
7278
"sphinx_design",
7379
"sphinx_togglebutton",
7480
"sphinx.ext.doctest",
7581
"sphinx_gallery.load_style",
7682
]
7783

84+
7885
coverage_show_missing_items = True
7986
panels_add_bootstrap_css = False
8087

@@ -137,6 +144,21 @@ def get_years(start_year=2021):
137144
# a list of builtin themes.
138145
html_theme = "pydata_sphinx_theme"
139146

147+
html_context = {
148+
"default_mode": "light",
149+
"switcher": {
150+
"version_match": "latest", # Adjust this dynamically per version
151+
"versions": [
152+
("latest", "/latest/"),
153+
("v0.2.0", "/v0.2.0/"),
154+
("v0.3.0", "/v0.3.0/"),
155+
("v0.4.0", "/v0.4.0/"),
156+
("v0.5.0rc1", "/v0.5.0rc1/"),
157+
],
158+
},
159+
"navbar_start": ["version-switcher", "navbar-logo"], # Place the dropdown above the logo
160+
}
161+
140162
# More info on theme options:
141163
# https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html
142164
html_theme_options = {
@@ -197,6 +219,8 @@ def get_years(start_year=2021):
197219
]
198220

199221
nbsphinx_thumbnails = {
222+
"demo_notebooks/CEBRA_best_practices":
223+
"_static/thumbnails/cebra-best.png",
200224
"demo_notebooks/Demo_primate_reaching":
201225
"_static/thumbnails/ForelimbS1.png",
202226
"demo_notebooks/Demo_hippocampus":

docs/source/figures.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Figures
22
=======
33

4-
CEBRA was introduced in `Schneider, Lee and Mathis (2022)`_ and applied to various datasets across
4+
CEBRA was introduced in `Schneider, Lee and Mathis (2023)`_ and applied to various datasets across
55
animals and recording modalities.
66

77
In this section, we provide reference code for reproducing the figures and experiments. Since especially
@@ -56,4 +56,4 @@ differ in minor typographic details.
5656

5757

5858

59-
.. _Schneider, Lee and Mathis (2022): https://arxiv.org/abs/2204.00673
59+
.. _Schneider, Lee and Mathis (2023): https://www.nature.com/articles/s41586-023-06031-6

docs/source/index.rst

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,18 @@ Please support the development of CEBRA by starring and/or watching the project
3434
Installation and Setup
3535
----------------------
3636

37-
Please see the dedicated :doc:`Installation Guide </installation>` for information on installation options using ``conda``, ``pip`` and ``docker``.
38-
39-
Have fun! 😁
37+
Please see the dedicated :doc:`Installation Guide </installation>` for information on installation options using ``conda``, ``pip`` and ``docker``. Have fun! 😁
4038

4139
Usage
4240
-----
4341

4442
Please head over to the :doc:`Usage </usage>` tab to find step-by-step instructions to use CEBRA on your data. For example use cases, see the :doc:`Demos </demos>` tab.
4543

46-
Integrations
47-
------------
48-
49-
CEBRA can be directly integrated with existing libraries commonly used in data analysis. The ``cebra.integrations`` module
50-
is getting actively extended. Right now, we offer integrations for ``scikit-learn``-like usage of CEBRA, a package making use of ``matplotlib`` to plot the CEBRA model results, as well as the
51-
possibility to compute CEBRA embeddings on DeepLabCut_ outputs directly.
52-
5344

5445
Licensing
5546
---------
56-
57-
Since version 0.4.0, CEBRA is open source software under an Apache 2.0 license.
47+
The ideas presented in our package are currently patent pending (Patent No. WO2023143843).
48+
Since version 0.4.0, CEBRA's source is licenced under an Apache 2.0 license.
5849
Prior versions 0.1.0 to 0.3.1 were released for academic use only.
5950

6051
Please see the full license file on Github_ for further information.
@@ -65,13 +56,19 @@ Contributing
6556

6657
Please refer to the :doc:`Contributing </contributing>` tab to find our guidelines on contributions.
6758

68-
Code contributors
59+
Code Contributors
6960
-----------------
7061

71-
The CEBRA code was originally developed by Steffen Schneider, Jin H. Lee, and Mackenzie Mathis (up to internal version 0.0.2). As of March 2023, it is being actively extended and maintained by `Steffen Schneider`_, `Célia Benquet`_, and `Mackenzie Mathis`_.
62+
The CEBRA code was originally developed by Steffen Schneider, Jin H. Lee, and Mackenzie Mathis (up to internal version 0.0.2). Please see our AUTHORS file for more information.
7263

73-
References
74-
----------
64+
Integrations
65+
------------
66+
67+
CEBRA can be directly integrated with existing libraries commonly used in data analysis. Namely, we provide a ``scikit-learn`` style interface to use CEBRA. Additionally, we offer integrations with our ``scikit-learn``-style of using CEBRA, a package making use of ``matplotlib`` and ``plotly`` to plot the CEBRA model results, as well as the possibility to compute CEBRA embeddings on DeepLabCut_ outputs directly. If you have another suggestion, please head over to Discussions_ on GitHub_!
68+
69+
70+
Key References
71+
--------------
7572
.. code::
7673
7774
@article{schneider2023cebra,
@@ -82,14 +79,22 @@ References
8279
year = {2023},
8380
}
8481
82+
@article{xCEBRA2025,
83+
author={Steffen Schneider and Rodrigo Gonz{\'a}lez Laiz and Anastasiia Filippova and Markus Frey and Mackenzie W Mathis},
84+
title = {Time-series attribution maps with regularized contrastive learning},
85+
journal = {AISTATS},
86+
url = {https://openreview.net/forum?id=aGrCXoTB4P},
87+
year = {2025},
88+
}
89+
8590
This documentation is based on the `PyData Theme`_.
8691

8792

8893
.. _`Twitter`: https://twitter.com/cebraAI
8994
.. _`PyData Theme`: https://github.com/pydata/pydata-sphinx-theme
9095
.. _`DeepLabCut`: https://deeplabcut.org
96+
.. _`Discussions`: https://github.com/AdaptiveMotorControlLab/CEBRA/discussions
9197
.. _`Github`: https://github.com/AdaptiveMotorControlLab/cebra
9298
.. _`email`: mailto:[email protected]
9399
.. _`Steffen Schneider`: https://github.com/stes
94-
.. _`Célia Benquet`: https://github.com/CeliaBenquet
95100
.. _`Mackenzie Mathis`: https://github.com/MMathisLab

docs/source/installation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Installation Guide
44
System Requirements
55
-------------------
66

7-
CEBRA is written in Python (3.8+) and PyTorch. CEBRA is most effective when used with a GPU, but CPU-only support is provided. We provide instructions to run CEBRA on your system directly. The instructions below were tested on different compute setups with Ubuntu 18.04 or 20.04, using Nvidia GTX 2080, A4000, and V100 cards. Other setups are possible (including Windows), as long as CUDA 10.2+ support is guaranteed.
7+
CEBRA is written in Python (3.9+) and PyTorch. CEBRA is most effective when used with a GPU, but CPU-only support is provided. We provide instructions to run CEBRA on your system directly. The instructions below were tested on different compute setups with Ubuntu 18.04 or 20.04, using Nvidia GTX 2080, A4000, and V100 cards. Other setups are possible (including Windows), as long as CUDA 10.2+ support is guaranteed.
88

99
- Software dependencies and operating systems:
1010
- Linux or MacOS
@@ -93,11 +93,11 @@ we outline different options below.
9393
9494
* 🚀 For more advanced users, CEBRA has different extra install options that you can select based on your usecase:
9595

96-
* ``[integrations]``: This will install (experimental) support for our streamlit and jupyter integrations.
96+
* ``[integrations]``: This will install (experimental) support for integrations, such as plotly.
9797
* ``[docs]``: This will install additional dependencies for building the package documentation.
9898
* ``[dev]``: This will install additional dependencies for development, unit and integration testing,
9999
code formatting, etc. Install this extension if you want to work on a pull request.
100-
* ``[demos]``: This will install additional dependencies for running our demo notebooks.
100+
* ``[demos]``: This will install additional dependencies for running our demo notebooks in Jupyter.
101101
* ``[datasets]``: This extension will install additional dependencies to use the pre-installed datasets
102102
in ``cebra.datasets``.
103103

0 commit comments

Comments
 (0)