Ejemplo n.º 1
0
    def _layers_op(self):
        '''Operator to build the layers for the model.
        This function should not be called by the variables outside the class and
        is to be implemented by all the subclasses'''
        self.layers.append(
            SparseGC(input_dim=self.input_dim,
                     output_dim=self.model_params.hidden_layer1_size,
                     supports=self.supports,
                     dropout_rate=self.dropout_rate,
                     activation=tf.nn.relu,
                     sparse_features=self.model_params.sparse_features,
                     num_elements=self.num_elements))

        self.layers.append(
            SparseGC(
                input_dim=self.model_params.hidden_layer1_size,
                # output_dim=int(self.output_shape[1]),
                output_dim=self.model_params.hidden_layer2_size,
                supports=self.supports,
                dropout_rate=self.dropout_rate,
                activation=lambda x: x,
                sparse_features=False,
                num_elements=self.num_elements))

        # So far, we have just added the GCN model.

        self.layers.append(
            InnerProductDecoder(input_dim=self.input_dim,
                                output_dim=self.input_dim,
                                dropout_rate=self.dropout_rate,
                                activation=lambda x: x,
                                sparse_features=False))
Ejemplo n.º 2
0
    def _layers_op(self):
        '''Operator to build the layers for the model.
        This function should not be called by the variables outside the class and
        is to be implemented by all the subclasses.

        This function implemenetation is different from the other _layer_ops as now our model is not sequential.'''

        self.layers.append(
            SparseGC(input_dim=self.input_dim,
                     output_dim=self.model_params.hidden_layer1_size,
                     supports=self.supports,
                     dropout_rate=self.dropout_rate,
                     activation=tf.nn.relu,
                     sparse_features=self.model_params.sparse_features,
                     num_elements=self.num_elements))

        self.mean_encoder = self._mean_encoder_op()

        self.log_sigma_encoder = self._log_sigma_encoder_op()

        self.decoder = InnerProductDecoder(input_dim=self.input_dim,
                                           output_dim=self.input_dim,
                                           dropout_rate=self.dropout_rate,
                                           activation=lambda x: x,
                                           sparse_features=False)
Ejemplo n.º 3
0
 def _log_sigma_encoder_op(self):
     '''Component of the encoder op which learns the log of sigma'''
     return SparseGC(input_dim=self.model_params.hidden_layer1_size,
                     output_dim=self.model_params.hidden_layer2_size,
                     supports=self.supports,
                     dropout_rate=self.dropout_rate,
                     activation=lambda x: x,
                     sparse_features=False,
                     num_elements=self.num_elements)