src/sagemaker_sklearn_extension/contrib/taei/models.py [221:251]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        self.encoder = nn.Sequential(*self.encoder)

        # Decoder
        hidden_dim = hidden_dim + [latent_dim]
        self.decoder = []
        for i in range(len(hidden_dim) - 1, 1, -1):
            self.decoder.extend(
                (nn.Linear(hidden_dim[i], hidden_dim[i - 1]), GBN(hidden_dim[i - 1]), nn.PReLU(hidden_dim[i - 1]))
            )
        self.decoder = nn.Sequential(*self.decoder)

        if self.continuous_features:
            self.cont_net = nn.Sequential(nn.Linear(hidden_dim[1], len(self.continuous_features)),)

        if self.categorical_features:
            self.cat_nets = nn.ModuleList()
            for i, n_cats in zip(self.categorical_features, self.categorical_dims):
                self.cat_nets.append(nn.Sequential(nn.Linear(hidden_dim[1], n_cats), LambdaLogSoftmax(dim=1)))

        self.apply(weight_init)

    def decode(self, z):
        """note: order of decoding is important for loss function"""
        z = self.decoder(z)
        x_hat = []
        if hasattr(self, "cont_net"):
            x_hat.append(self.cont_net(z))
        if hasattr(self, "cat_nets"):
            for m in self.cat_nets:
                x_hat.append(m(z))
        return x_hat
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/sagemaker_sklearn_extension/contrib/taei/models.py [339:369]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        self.encoder = nn.Sequential(*self.encoder)

        # Decoder
        hidden_dim = hidden_dim + [latent_dim]
        self.decoder = []
        for i in range(len(hidden_dim) - 1, 1, -1):
            self.decoder.extend(
                (nn.Linear(hidden_dim[i], hidden_dim[i - 1]), GBN(hidden_dim[i - 1]), nn.PReLU(hidden_dim[i - 1]))
            )
        self.decoder = nn.Sequential(*self.decoder)

        if self.continuous_features:
            self.cont_net = nn.Sequential(nn.Linear(hidden_dim[1], len(self.continuous_features)),)

        if self.categorical_features:
            self.cat_nets = nn.ModuleList()
            for i, n_cats in zip(self.categorical_features, self.categorical_dims):
                self.cat_nets.append(nn.Sequential(nn.Linear(hidden_dim[1], n_cats), LambdaLogSoftmax(dim=1)))

        self.apply(weight_init)

    def decode(self, z):
        """note: order of decoding is important for loss function"""
        z = self.decoder(z)
        x_hat = []
        if hasattr(self, "cont_net"):
            x_hat.append(self.cont_net(z))
        if hasattr(self, "cat_nets"):
            for m in self.cat_nets:
                x_hat.append(m(z))
        return x_hat
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



