Skip to content

Commit f5dc743

Browse files
committed
extend multiobjective docs
1 parent df6679d commit f5dc743

File tree

3 files changed

+42
-15
lines changed

3 files changed

+42
-15
lines changed

cebra/attribution/jacobian_attribution.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ def get_attribution_map(
7272
hybrid_solver: If ``True``, handle multi-objective models differently.
7373
7474
Returns:
75-
A tuple containing:
76-
- jf: The Jacobian matrix of shape (num_samples, output_dim, input_dim)
77-
- jhatg: The pseudo-inverse of the Jacobian matrix
78-
The result is effectively a ``(num_inputs, num_features)`` attribution map.
75+
A tuple containing the Jacobian matrix of shape (num_samples, output_dim, input_dim)
76+
and the pseudo-inverse of the Jacobian matrix.
77+
7978
"""
8079
assert aggregate in ["mean", "sum", "max"]
8180

cebra/solver/multiobjective.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,26 @@
1919
# See the License for the specific language governing permissions and
2020
# limitations under the License.
2121
#
22-
"""Multiobjective contrastive learning."""
22+
"""Multiobjective contrastive learning.
23+
24+
Starting in CEBRA 0.6.0, we have added support for subspace contrastive learning.
25+
This is a method for training models that are able to learn multiple subspaces of the
26+
feature space simultaneously.
27+
28+
Subspace contrastive learning requires to use specialized models and criterions.
29+
This module specifies a test of classes required for training CEBRA models with multiple objectives.
30+
The objectives are defined by the wrapper class :py:class:`cebra.models.multicriterions.MultiCriterions`.
31+
32+
Two solvers are currently implemented:
33+
34+
- :py:class:`cebra.solver.multiobjective.ContrastiveMultiobjectiveSolverxCEBRA`
35+
- :py:class:`cebra.solver.multiobjective.SupervisedMultiobjectiveSolverxCEBRA`
36+
37+
See Also:
38+
:py:class:`cebra.solver.multiobjective.SupervisedMultiobjectiveSolverxCEBRA`
39+
:py:class:`cebra.solver.multiobjective.MultiObjectiveConfig`
40+
:py:class:`cebra.models.multicriterions.MultiCriterions`
41+
"""
2342

2443
import logging
2544
import time
@@ -43,6 +62,8 @@
4362
class MultiObjectiveConfig:
4463
"""Configuration class for setting up multi-objective learning with Cebra.
4564
65+
66+
4667
Args:
4768
loader: Data loader used for configurations.
4869
"""
@@ -458,7 +479,11 @@ def transform(self, inputs: torch.Tensor) -> torch.Tensor:
458479
@register("supervised-solver-xcebra")
459480
@dataclasses.dataclass
460481
class SupervisedMultiobjectiveSolverxCEBRA(MultiobjectiveSolverBase):
461-
"""Supervised neural network training with MSE loss"""
482+
"""Supervised neural network training using the MSE loss.
483+
484+
This solver can be used as a baseline variant instead of the contrastive solver,
485+
:py:class:`cebra.solver.multiobjective.ContrastiveMultiobjectiveSolverxCEBRA`.
486+
"""
462487

463488
_variant_name = "supervised-solver-xcebra"
464489

@@ -477,6 +502,15 @@ def _inference(self, batch):
477502
@register("multiobjective-solver")
478503
@dataclasses.dataclass
479504
class ContrastiveMultiobjectiveSolverxCEBRA(MultiobjectiveSolverBase):
505+
"""Multi-objective solver for CEBRA.
506+
507+
This solver is used for training CEBRA models with multiple objectives.
508+
509+
See Also:
510+
:py:class:`cebra.solver.multiobjective.SupervisedMultiobjectiveSolverxCEBRA`
511+
:py:class:`cebra.solver.multiobjective.MultiObjectiveConfig`
512+
:py:class:`cebra.models.multicriterions.MultiCriterions`
513+
"""
480514

481515
_variant_name = "contrastive-solver-xcebra"
482516

docs/source/api/xcebra/multiobjective.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22
Multi-objective models
33
======================
44

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
5+
.. automodule:: cebra.solver.multiobjective
126
:members:
137
:show-inheritance:
148

15-
.. automodule:: cebra.models.multiobjective
9+
.. automodule:: cebra.models.multicriterions
1610
:members:
1711
:show-inheritance:
1812

19-
.. automodule:: cebra.solver.multiobjective
13+
.. automodule:: cebra.models.multiobjective
2014
:members:
2115
:show-inheritance:

0 commit comments

Comments
 (0)