GOOD.ood_algorithms.algorithms.DANN
Implementation of the DANN algorithm from “Domain-Adversarial Training of Neural Networks” paper
Classes
|
Implementation of the DANN algorithm from "Domain-Adversarial Training of Neural Networks" paper |
- class GOOD.ood_algorithms.algorithms.DANN.DANN(config: Union[CommonArgs, Munch])[source]
Bases:
BaseOODAlg
Implementation of the DANN algorithm from “Domain-Adversarial Training of Neural Networks” paper
- Args:
config (Union[CommonArgs, Munch]): munchified dictionary of args (
config.model.model_level
,config.metric.cross_entropy_with_logit()
,config.ood.ood_param
)
- loss_postprocess(loss: Tensor, data: Batch, mask: Tensor, config: Union[CommonArgs, Munch], **kwargs) Tensor [source]
Process loss based on DANN algorithm
- Parameters
loss (Tensor) – base loss between model predictions and input labels
data (Batch) – input data
mask (Tensor) – NAN masks for data formats
config (Union[CommonArgs, Munch]) – munchified dictionary of args (
config.model.model_level
,config.metric.cross_entropy_with_logit()
,config.ood.ood_param
)
config = munchify({model: {model_level: str('graph')}, metric: {cross_entropy_with_logit()}, ood: {ood_param: float(0.1)} })
- Returns (Tensor):
loss based on DANN algorithm