otx.api.configuration#
OTX configurable parameters and helper utilities.
This module contains base elements that make up OTX ConfigurableParameters, as well as a collection of helper functions to interact with them.
The configuration helper module can be imported as otx_config_helper and implements the following:
Classes
|
This class is used as the basis for defining selectable configurable parameters in the OTX API. |
|
This Enum represents the different stages in the ModelLifecycle. |
|
This Enum represents the allowed actions that UI rules can dictate on configuration parameters. |
|
This class represents an empty, unset UIRules element. |
|
This Enum represents the allowed operators for use in constructing UI rules for configuration parameters. |
|
This class represents a operator applied to the value of the configurable parameter parameter. |
|
This class allows the combination of ExposureRules using boolean logic. |
|
Configuration element representing a the default set of hyper parameters for a model. |
|
Base class representing a generic set of configurable parameters. |
- class otx.api.configuration.Action(value)[source]#
Bases:
Enum
This Enum represents the allowed actions that UI rules can dictate on configuration parameters.
- class otx.api.configuration.ConfigurableEnum(value)[source]#
Bases:
Enum
This class is used as the basis for defining selectable configurable parameters in the OTX API.
Enums reflecting selectable options should inherit from thisclass.
- classmethod get_class_info() dict [source]#
Creates a dictionary representation of the ConfigurableEnum.
This includes the name of the enum and the (name, value) pairs representing its members.
- Returns:
Dictionary representation of the ConfigurableEnum.
- Return type:
- class otx.api.configuration.ConfigurableParameters(header: str, description: str = 'Default parameter group description', visible_in_ui: bool = True, *, id: str | ID | None = ID())[source]#
Bases:
ParameterGroup
Base class representing a generic set of configurable parameters.
A ConfigurableParameters instance is essentially a parameter group with an id attached to it, so that it can be uniquely identified in the repositories.
- type#
Type of the ConfigurableParameters
- Type:
ConfigElementType
Method generated by attrs for class ConfigurableParameters.
- class otx.api.configuration.DefaultModelParameters(visible_in_ui: bool = True, header: str = 'Default model hyper parameters', learning_parameters: _LearningParameters = _Nothing.NOTHING, *, id: str | ID | None = ID(), description: str = 'Default model hyper parameter section description')[source]#
Bases:
ConfigurableParameters
Configuration element representing a the default set of hyper parameters for a model.
- description#
User friendly string describing what the ModelConfig represents, that will be displayed in the UI.
- Type:
Method generated by attrs for class DefaultModelParameters.
- class otx.api.configuration.ModelLifecycle(value)[source]#
Bases:
Enum
This Enum represents the different stages in the ModelLifecycle.
It is used by configuration parameters to indicate in which stage of the model lifecycle the parameter takes effect. Selecting a stage early in the lifecycle implies that all downstream stages are affected as well (e.g. if this is set to ModelLifecycle.TRAINING, it is assumed that inference and testing are also impacted).
Currently the following stages are possible: ARCHITECTURE - Select this stage if the parameter modifies the model architecture, such that the most recently
trained weights cannot directly by used for the next training round due to a model topology mismatch. For example, a parameter model_depth that controls the number of downsampling steps in a UNet model should have this stage set.
- TRAINING - Select this stage if the parameter is likely to change the outcome of the training process. For example,
the parameter learning_rate should have this stage set.
- INFERENCE - Select this stage if the parameter changes the result of inference. For example, a parameter
probability_threshold that controls the threshold for binary classification should have this stage set.
- TESTING - Select this stage if the parameter changes the outcome of the evaluation process. For example, a parameter
‘test_metric` that controls which metric to use for testing does not change training or inference results, but does affect the final evaluation of the model. Therefore, it should have this stage set.
- NONE - Select this stage if the parameter is non-functional, for example if it only impacts training speed but
should not change the training outcome. For example, a parameter num_workers that controls the number of threads used in a dataloader should have this stage set.
- class otx.api.configuration.NullUIRules(operator: str | Operator = Operator.AND, action: str | Action = Action.DISABLE_EDITING, type: ConfigElementType = ConfigElementType.UI_RULES, rules: List[Rule | UIRules] = _Nothing.NOTHING)[source]#
Bases:
UIRules
This class represents an empty, unset UIRules element.
Method generated by attrs for class NullUIRules.
- class otx.api.configuration.Operator(value)[source]#
Bases:
Enum
This Enum represents the allowed operators for use in constructing UI rules for configuration parameters.
These operators can be used to disable a configuration parameter, conditional on the value of another parameter.
- class otx.api.configuration.Rule(parameter: str | List[str], value: int | str | float | bool, operator: str | Operator = Operator.EQUAL_TO, type: ConfigElementType = ConfigElementType.RULE)[source]#
Bases:
object
This class represents a operator applied to the value of the configurable parameter parameter.
The parameter for which the rule should be evaluated is identified by name, or by a list of names representing the attribute path to the parameter in case of a nested configuration.
Method generated by attrs for class Rule.
- class otx.api.configuration.UIRules(operator: str | Operator = Operator.AND, action: str | Action = Action.DISABLE_EDITING, type: ConfigElementType = ConfigElementType.UI_RULES, *, rules: List[Rule | UIRules])[source]#
Bases:
object
This class allows the combination of ExposureRules using boolean logic.
The class can be set as an attribute of a configurable parameter. If the rules (combined according to the operator) evaluate to True, the corresponding`action` will be taken in the UI.
If UIRules are nested, only the action of the outermost UIRule will be considered.
Method generated by attrs for class UIRules.
- to_dict(enum_to_str: bool = True) dict [source]#
Method to serialize an UIRules instance to its dictionary representation.
Applies recursion to convert nested rules, if applicable.
- Parameters:
enum_to_str – Set to True to convert Enum instances to their string representation
- Returns:
dictionary representation of the UIRules object for which this method is called
Modules
This module contains the keys that can be used to retrieve parameter metadata. |
|
This module contains the configuration helper functions. |
|
This module contains the configuration helper functions. |