Esempio n. 1
0
    def create(self, architecture: Architecture, metadata: Metadata,
               arguments: Configuration) -> Any:
        reconstruction_loss = self.create_other(
            arguments.reconstruction_loss.factory, architecture, metadata,
            arguments.reconstruction_loss.get("arguments", {}))

        return AutoEncoderLoss(reconstruction_loss,
                               **arguments.get_all_defined(["masked"]))
Esempio n. 2
0
    def create(self, architecture: Architecture, metadata: Metadata,
               arguments: Configuration) -> Any:
        reconstruction_loss = self.create_other(
            arguments.reconstruction_loss.factory, architecture, metadata,
            arguments.reconstruction_loss.get("arguments", {}))

        optional_arguments = arguments.get_all_defined(
            ["reconstruction_loss_weight"])

        return GAINGeneratorLoss(reconstruction_loss, **optional_arguments)
Esempio n. 3
0
    def create(self, architecture: Architecture, metadata: Metadata,
               arguments: Configuration) -> Any:
        optional = arguments.get_all_defined(["sizes", "bn_decay", "shortcut"])

        if "activation" in arguments:
            activation_configuration = arguments.activation
            optional["activation"] = self.create_other(
                activation_configuration.factory, architecture, metadata,
                activation_configuration.get("arguments", {}))

        return HiddenLayersFactory(**optional)
Esempio n. 4
0
    def create(self, architecture: Architecture, metadata: Metadata,
               arguments: Configuration) -> Any:
        # override the reduction argument
        reconstruction_loss_configuration = arguments.reconstruction_loss.get(
            "arguments", {})
        if "reduction" in reconstruction_loss_configuration:
            assert reconstruction_loss_configuration["reduction"] == "sum"
        else:
            reconstruction_loss_configuration["reduction"] = "sum"

        # create the reconstruction loss
        reconstruction_loss = self.create_other(
            arguments.reconstruction_loss.factory, architecture, metadata,
            reconstruction_loss_configuration)

        # create the vae loss
        return VAELoss(reconstruction_loss,
                       **arguments.get_all_defined(["masked"]))
Esempio n. 5
0
 def create(self, architecture: Architecture, metadata: Metadata,
            arguments: Configuration) -> Any:
     return MultiInputDropout(
         metadata, **arguments.get_all_defined(self.optional_arguments()))
Esempio n. 6
0
 def create(self, architecture: Architecture, metadata: Metadata,
            arguments: Configuration) -> Any:
     return self.wrapped_class(
         **arguments.get_all_defined(self.optional_class_arguments))
Esempio n. 7
0
 def impute(self, configuration: Configuration, metadata: Metadata,
            scaled_inputs: Tensor, missing_mask: Tensor) -> Tensor:
     optional = configuration.get_all_defined(["noise_mean", "noise_std"])
     optional["differentiable"] = False
     return NormalNoiseImputationLayer(**optional)(scaled_inputs,
                                                   missing_mask)
Esempio n. 8
0
 def create(self, architecture: Architecture, metadata: Metadata,
            arguments: Configuration) -> Any:
     return MeanAndModesImputationLayer(
         to_gpu_if_available(
             torch.from_numpy(np.load(arguments.path)).float()),
         **arguments.get_all_defined(["differentiable"]))
Esempio n. 9
0
 def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any:
     return MultiReconstructionLoss(metadata, **arguments.get_all_defined(self.optional_arguments()))