Skip to content

Commit e4d717d

Browse files
committed
docs writing
1 parent 9462caf commit e4d717d

File tree

10 files changed

+86
-25
lines changed

10 files changed

+86
-25
lines changed

cebra/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from cebra.models.multiobjective import *
3737
from cebra.models.layers import *
3838
from cebra.models.criterions import *
39-
from cebra.models.multi_criterions import *
39+
from cebra.models.multicriterions import *
4040
from cebra.models.jacobian_regularizer import *
4141

4242
cebra.registry.add_docstring(__name__)

cebra/models/jacobian_regularizer.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3838
# SOFTWARE.
3939
#
40+
"""Jacobian Regularization for CEBRA.
41+
42+
This implementation is adapted from the Jacobian regularization described in [1]_.
43+
44+
.. [1] Judy Hoffman, Daniel A. Roberts, and Sho Yaida,
45+
"Robust Learning with Jacobian Regularization," 2019.
46+
`arxiv:1908.02729 <https://arxiv.org/abs/1908.02729>`_
47+
"""
4048

4149
from __future__ import division
4250

@@ -52,12 +60,6 @@ class JacobianReg(nn.Module):
5260
of the output space and projection is non-random and orthonormal, yielding the exact
5361
result. For any reasonable batch size, the default (n=1) should be sufficient.
5462
|Default:| ``1``
55-
56-
Note:
57-
This implementation is adapted from the Jacobian regularization described in [1].
58-
[1] Judy Hoffman, Daniel A. Roberts, and Sho Yaida,
59-
"Robust Learning with Jacobian Regularization," 2019.
60-
[arxiv:1908.02729](https://arxiv.org/abs/1908.02729)
6163
"""
6264

6365
def __init__(self, n: int = 1):
@@ -66,7 +68,7 @@ def __init__(self, n: int = 1):
6668
super(JacobianReg, self).__init__()
6769

6870
def forward(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
69-
"""Computes (1/2) tr |dy/dx|^2.
71+
"""Computes (1/2) tr \\|dy/dx\\|^2.
7072
7173
Args:
7274
x: Input tensor
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
# See the License for the specific language governing permissions and
2020
# limitations under the License.
2121
#
22+
"""Support for training CEBRA with multiple criteria.
23+
24+
.. note::
25+
This module was introduced in CEBRA 0.6.0.
26+
27+
"""
2228
from typing import Tuple
2329

2430
import torch

docs/source/api.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ these components in other contexts and research code bases.
3838
api/pytorch/distributions
3939
api/pytorch/models
4040
api/pytorch/helpers
41-
api/pytorch/attribution
41+
api/xcebra/multiobjective
42+
api/xcebra/regularized
43+
api/xcebra/attribution
4244

4345
.. toctree::
4446
:hidden:

docs/source/api/pytorch/attribution.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/api/pytorch/models.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,5 @@ Layers and model building blocks
4242
:members:
4343
:show-inheritance:
4444

45-
Multi-objective models
46-
~~~~~~~~~~~~~~~~~~~~~~~~
47-
48-
.. automodule:: cebra.models.multiobjective
49-
:members:
50-
:private-members:
51-
:show-inheritance:
52-
5345
..
5446
- projector
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
===================
2+
Attribution Methods
3+
===================
4+
5+
.. automodule:: cebra.attribution
6+
:members:
7+
:show-inheritance:
8+
9+
Different attribution methods
10+
-----------------------------
11+
12+
.. automodule:: cebra.attribution.attribution_models
13+
:members:
14+
:show-inheritance:
15+
16+
Jacobian-based attribution
17+
--------------------------
18+
19+
.. automodule:: cebra.attribution.jacobian_attribution
20+
:members:
21+
:show-inheritance:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
======================
2+
Multi-objective models
3+
======================
4+
5+
Starting in CEBRA 0.6.0, we have added support for subspace contrastive learning.
6+
This is a method for training models that are able to learn multiple subspaces of the
7+
feature space simultaneously.
8+
9+
Subspace contrastive learning requires to use specialized models and criterions.
10+
11+
.. automodule:: cebra.models.multicriterions
12+
:members:
13+
:show-inheritance:
14+
15+
.. automodule:: cebra.models.multiobjective
16+
:members:
17+
:show-inheritance:
18+
19+
.. automodule:: cebra.solver.multiobjective
20+
:members:
21+
:show-inheritance:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
================================
2+
Regularized Contrastive Learning
3+
================================
4+
5+
Regularized solvers
6+
--------------------
7+
8+
.. automodule:: cebra.solver.regularized
9+
:members:
10+
:show-inheritance:
11+
12+
Schedulers
13+
----------
14+
15+
.. automodule:: cebra.solver.schedulers
16+
:members:
17+
:show-inheritance:
18+
19+
Jacobian Regularization
20+
-----------------------
21+
22+
.. automodule:: cebra.models.jacobian_regularizer
23+
:members:
24+
:show-inheritance:

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def get_years(start_year=2021):
203203
],
204204
"collapse_navigation": False,
205205
"navigation_depth": 1,
206-
"show_nav_level": 2,
206+
"show_nav_level": 1,
207207
"navbar_align": "content",
208208
"show_prev_next": False,
209209
"navbar_end": ["theme-switcher", "navbar-icon-links.html"],

0 commit comments

Comments
 (0)