output#
Constraints on the output responses of a model
Classes
|
Dummy constraint function that proposes all samples as feasible. |
|
Calculates the L1 (absolute-value penalized) constraint |
|
Output constraint for a given set of targets. |
- class obsidian.constraints.output.Blank_Constraint(target: Target | list[Target])[source]#
Bases:
Output_Constraint
Dummy constraint function that proposes all samples as feasible.
- forward(scale: bool = True) Callable [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class obsidian.constraints.output.L1_Constraint(target: Target | list[Target], offset: int | float = 1)[source]#
Bases:
Output_Constraint
Calculates the L1 (absolute-value penalized) constraint
- forward(scale: bool = True) Callable [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class obsidian.constraints.output.Output_Constraint(target: Target | list[Target])[source]#
Bases:
Constraint
Output constraint for a given set of targets.
- Must return a callable function that computes feasibility, where
negative values imply feasible space.
Note: Saving and loading input constraints is managed by Campaign