@@ -15,14 +15,27 @@ class ScoringRule:
1515 when sampling from the true distribution. By minimizing an expected score, estimates with
1616 different properties can be obtained.
1717
18- To define a custom `` ScoringRule` `, inherit from this class and overwrite the score method.
18+ To define a custom :class:` ScoringRule`, inherit from this class and overwrite the score method.
1919 For proper serialization, any new constructor arguments must be taken care of in a `get_config` method.
2020
2121 Estimates are typically parameterized by projection heads consisting of a neural network component
2222 and a link to project into the correct output space.
2323
24- `ScoringRule`s can score estimates consisting of multiple parts. See `MultivariateNormalScore` for an example
25- of a `ParametricDistributionScore`. The score evaluates an estimated mean and covariance simultaneously.
24+ A :class:`ScoringRule` can score estimates consisting of multiple parts. See :class:`MultivariateNormalScore`
25+ for an example of a :class:`ParametricDistributionScore`. That score evaluates an estimated mean
26+ and covariance simultaneously.
27+ """
28+
29+ NOT_TRANSFORMING_LIKE_VECTOR_WARNING = tuple ()
30+ """
31+ This variable contains names of prediction heads that should lead to a warning when the adapter is applied
32+ in inverse direction to them.
33+
34+ Prediction heads can output estimates in spaces other than the target distribution space.
35+ To such estimates the adapter cannot be straightforwardly applied in inverse direction,
36+ because the adapter is built to map vectors from the inference variable space. When subclassing
37+ :class:`ScoringRule`, add the names of such heads to the following list to warn users about difficulties
38+ with a type of estimate whenever the adapter is applied to them in inverse direction.
2639 """
2740
2841 def __init__ (
@@ -35,13 +48,6 @@ def __init__(
3548 self .subnets_kwargs = subnets_kwargs or {}
3649 self .links = links or {}
3750
38- # Prediction heads can output estimates in spaces other than the target distribution space.
39- # To such estimates the adapter cannot be straightforwardly applied in inverse direction,
40- # because the adapter is built to map vectors. When subclassing `ScoringRule`, add the names
41- # of such heads to the following list to warn users about difficulties with a type of estimate
42- # whenever the adapter is applied to them in inverse direction.
43- self .not_transforming_like_vector_warning = []
44-
4551 self .config = {"subnets_kwargs" : self .subnets_kwargs }
4652
4753 def get_config (self ):
@@ -117,10 +123,12 @@ def get_head(self, key: str, output_shape: Shape) -> keras.Sequential:
117123 """For a specified head key and output shape, request corresponding head network.
118124
119125 A head network has the following components that are called sequentially:
126+
120127 1. subnet: A keras.Layer.
121128 2. dense: A trainable linear projection with as many units as are required by the next component.
122129 3. reshape: Changes shape of output of projection to match requirements of next component.
123130 4. link: Transforms unconstrained values into a constrained space for the final estimator.
131+ See :mod:`bayesflow.links` for examples.
124132
125133 This method initializes the components in reverse order to meet all requirements and returns them.
126134
@@ -130,7 +138,7 @@ def get_head(self, key: str, output_shape: Shape) -> keras.Sequential:
130138 Name of head for which to request a link.
131139 output_shape: Shape
132140 The necessary shape of estimated values for the given key as returned by
133- `scoring_rule. get_head_shapes_from_target_shape()`.
141+ :func:` get_head_shapes_from_target_shape()`.
134142
135143 Returns
136144 -------
@@ -173,11 +181,11 @@ def score(self, estimates: dict[str, Tensor], targets: Tensor, weights: Tensor)
173181
174182 Examples
175183 --------
176- The following shows how to score estimates with a `` MeanScore`` . All `` ScoringRule`` s follow this pattern,
177- only differing in the structure of the estimates dictionary.
184+ The following shows how to score estimates with a :class:` MeanScore`. All :class:` ScoringRule` s
185+ follow this pattern, only differing in the structure of the estimates dictionary.
178186
179187 >>> import keras
180- ... from bayesflow.scores import MeanScore
188+ >>> from bayesflow.scores import MeanScore
181189 >>>
182190 >>> # batch of samples from a normal distribution
183191 >>> samples = keras.random.normal(shape=(100,))
0 commit comments