@@ -17,6 +17,12 @@ class ScoringRule:
1717
1818 To define a custom ``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.
20+
21+ Estimates are typically parameterized by projection heads consisting of a neural network component
22+ and a link to project into the correct output space.
23+
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.
2026 """
2127
2228 def __init__ (
@@ -29,7 +35,12 @@ def __init__(
2935 self .subnets_kwargs = subnets_kwargs or {}
3036 self .links = links or {}
3137
32- self .not_transforming_like_vector = []
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 = []
3344
3445 self .config = {"subnets_kwargs" : self .subnets_kwargs }
3546
@@ -60,12 +71,15 @@ def get_head_shapes_from_target_shape(self, target_shape: Shape) -> dict[str, Sh
6071
6172 def get_subnet (self , key : str ) -> keras .Layer :
6273 """For a specified key, request a subnet to be used for projecting the shared condition embedding
63- before reshaping to the heads output shape.
74+ before further projection and reshaping to the heads output shape.
75+
76+ If no subnet was specified for the key (e.g. upon initialization),
77+ return just an instance of keras.layers.Identity.
6478
6579 Parameters
6680 ----------
6781 key : str
68- Name of head for which to request a link .
82+ Name of head for which to request a subnet .
6983
7084 Returns
7185 -------
@@ -80,6 +94,8 @@ def get_subnet(self, key: str) -> keras.Layer:
8094 def get_link (self , key : str ) -> keras .Layer :
8195 """For a specified key, request a link from network output to estimation target.
8296
97+ If no link was specified for the key (e.g. upon initialization), return a linear activation.
98+
8399 Parameters
84100 ----------
85101 key : str
@@ -98,7 +114,15 @@ def get_link(self, key: str) -> keras.Layer:
98114 return self .links [key ]
99115
100116 def get_head (self , key : str , output_shape : Shape ) -> keras .Sequential :
101- """For a specified head key and shape, request corresponding head network.
117+ """For a specified head key and output shape, request corresponding head network.
118+
119+ A head network has the following components that are called sequentially:
120+ 1. subnet: A keras.Layer.
121+ 2. dense: A trainable linear projection with as many units as are required by the next component.
122+ 3. reshape: Changes shape of output of projection to match requirements of next component.
123+ 4. link: Transforms unconstrained values into a constrained space for the final estimator.
124+
125+ This method initializes the components in reverse order to meet all requirements and returns them.
102126
103127 Parameters
104128 ----------
0 commit comments