decomon.metrics package
Submodules
decomon.metrics.complexity module
decomon.metrics.loss module
- class decomon.metrics.loss.DecomonLossFusion(*args, **kwargs)[source]
Bases:
DecomonLayer
- compute_output_shape(input_shape: list[tuple[int | None, ...]]) tuple[int | None, ...] [source]
Compute expected output shape according to input shape
Will be called by symbolic calls on Keras Tensors.
We use the original (Keras) layer compute_output_shape() if available to update accordingly the input shapes.
Else we simply return the input shapes
Beware, compute_output_shape() is sometimes called by the original keras layer inside its call(), which can be called inside the decomon layer call(). Check this by looking at input_shape (list of shapes or simple shape?)
- Parameters:
input_shape –
Returns:
- get_config() dict[str, Any] [source]
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- original_keras_layer_class
alias of
Layer
- class decomon.metrics.loss.DecomonRadiusRobust(*args, **kwargs)[source]
Bases:
DecomonLayer
- compute_output_shape(input_shape: list[tuple[int | None, ...]]) tuple[int | None, ...] [source]
Compute expected output shape according to input shape
Will be called by symbolic calls on Keras Tensors.
We use the original (Keras) layer compute_output_shape() if available to update accordingly the input shapes.
Else we simply return the input shapes
Beware, compute_output_shape() is sometimes called by the original keras layer inside its call(), which can be called inside the decomon layer call(). Check this by looking at input_shape (list of shapes or simple shape?)
- Parameters:
input_shape –
Returns:
- get_config() dict[str, Any] [source]
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- original_keras_layer_class
alias of
Layer
- decomon.metrics.loss.build_asymptotic_crossentropy_model(model: DecomonModel) DecomonModel [source]
- decomon.metrics.loss.build_crossentropy_model(model: DecomonModel) DecomonModel [source]
- decomon.metrics.loss.build_radius_robust_model(model: DecomonModel) DecomonModel [source]
- decomon.metrics.loss.get_adv_loss(model: DecomonModel, sigmoid: bool = False, clip_value: float | None = None, softmax: bool = False) Callable[[KerasTensor | Any, KerasTensor | Any], KerasTensor | Any] [source]
- decomon.metrics.loss.get_lower_loss(model: DecomonModel) Callable[[KerasTensor | Any, KerasTensor | Any], KerasTensor | Any] [source]
- decomon.metrics.loss.get_model(model: DecomonModel) DecomonModel [source]
- decomon.metrics.loss.get_upper_loss(model: DecomonModel) Callable[[KerasTensor | Any, KerasTensor | Any], KerasTensor | Any] [source]
decomon.metrics.metric module
- class decomon.metrics.metric.AdversarialCheck(*args, **kwargs)[source]
Bases:
MetricLayer
Training with symbolic LiRPA bounds for promoting adversarial robustness
- class decomon.metrics.metric.AdversarialScore(*args, **kwargs)[source]
Bases:
AdversarialCheck
Training with symbolic LiRPA bounds for promoting adversarial robustness
- class decomon.metrics.metric.MetricMode(value)[source]
Bases:
str
,Enum
An enumeration.
- BACKWARD = 'backward'
- FORWARD = 'forward'
- class decomon.metrics.metric.UpperScore(*args, **kwargs)[source]
Bases:
MetricLayer
Training with symbolic LiRPA bounds for limiting the local maximum of a neural network
- decomon.metrics.metric.build_formal_adv_check_model(decomon_model: DecomonModel) Model [source]
automatic design on a Keras model which predicts a certificate of adversarial robustness
- Parameters:
decomon_model –
Returns:
- decomon.metrics.metric.build_formal_adv_model(decomon_model: DecomonModel) Model [source]
automatic design on a Keras model which predicts a certificate of adversarial robustness
- Parameters:
decomon_model –
Returns:
- decomon.metrics.metric.build_formal_upper_model(decomon_model: DecomonModel) Model [source]
automatic design on a Keras model which predicts a certificate on the local upper bound
- Parameters:
decomon_model –
Returns:
decomon.metrics.utils module
- decomon.metrics.utils.categorical_cross_entropy(inputs: list[KerasTensor | Any], dc_decomp: bool = False, mode: str | ForwardMode = ForwardMode.HYBRID, perturbation_domain: PerturbationDomain | None = None) list[KerasTensor | Any] [source]