[ { "function_name": "ContextGNN.__init__", "file_path": "contextgnn/nn/models/contextgnn.py", "function_calls": [ { "function_call_name": "super().__init__()", "functionality": "Initialize parent class (RHSEmbeddingGNN), which sets up global item embedding and config.", "input": "Arguments for the parent class RHSEmbeddingGNN.", "output": "None (initializes attributes and internal states).", "location_or_namespace": "contextgnn.nn.models.rhsembeddinggnn.RHSEmbeddingGNN" }, { "function_call_name": "HeteroEncoder()", "functionality": "Encodes multi-modal tabular features for each node type.", "input": "channels, node_to_col_names_dict, node_to_col_stats, stype_encoder_cls_kwargs, torch_frame_model_cls, torch_frame_model_kwargs", "output": "torch.nn.Module that outputs node features.", "location_or_namespace": "contextgnn.nn.encoder.HeteroEncoder" }, { "function_call_name": "HeteroTemporalEncoder()", "functionality": "Encodes relative time for each node type as features using positional encodings.", "input": "node_types, channels", "output": "torch.nn.Module that outputs temporal node features.", "location_or_namespace": "contextgnn.nn.encoder.HeteroTemporalEncoder" }, { "function_call_name": "HeteroGraphSAGE()", "functionality": "Heterogeneous GNN for message passing over multi-relation graphs.", "input": "node_types, edge_types, channels, aggr, num_layers", "output": "torch.nn.Module that computes updated node features.", "location_or_namespace": "contextgnn.nn.models.HeteroGraphSAGE" }, { "function_call_name": "MLP()", "functionality": "Multi-layer perceptron for transforming embeddings (used for scoring/prediction).", "input": "channels, out_channels=1, norm, num_layers", "output": "MLP module (torch.nn.Module) with output dimension out_channels.", "location_or_namespace": "torch_geometric.nn.MLP" }, { "function_call_name": "torch.nn.Linear()", "functionality": "Linear transformation (fully connected layer) used for projection and offset scoring.", "input": "in_features, out_features", "output": "torch.nn.Linear module.", "location_or_namespace": "torch.nn" }, { "function_call_name": "torch.nn.Embedding()", "functionality": "Creates an embedding matrix (ID awareness feature for user node).", "input": "num_embeddings, embedding_dim", "output": "Embedding lookup module.", "location_or_namespace": "torch.nn" } ] }, { "function_name": "ContextGNN.reset_parameters", "file_path": "contextgnn/nn/models/contextgnn.py", "function_calls": [ { "function_call_name": "super().reset_parameters()", "functionality": "Calls reset_parameters on the parent RHSEmbeddingGNN.", "input": "None", "output": "None", "location_or_namespace": "contextgnn.nn.models.rhsembeddinggnn.RHSEmbeddingGNN" }, { "function_call_name": "self.encoder.reset_parameters()", "functionality": "Resets the parameters of the HeteroEncoder module.", "input": "None", "output": "None", "location_or_namespace": "contextgnn.nn.encoder.HeteroEncoder" }, { "function_call_name": "self.temporal_encoder.reset_parameters()", "functionality": "Resets the parameters of the HeteroTemporalEncoder module.", "input": "None", "output": "None", "location_or_namespace": "contextgnn.nn.encoder.HeteroTemporalEncoder" }, { "function_call_name": "self.gnn.reset_parameters()", "functionality": "Resets the parameters of the HeteroGraphSAGE module.", "input": "None", "output": "None", "location_or_namespace": "contextgnn.nn.models.HeteroGraphSAGE" }, { "function_call_name": "self.head.reset_parameters()", "functionality": "Resets the parameters of the MLP head.", "input": "None", "output": "None", "location_or_namespace": "torch_geometric.nn.MLP" }, { "function_call_name": "self.id_awareness_emb.reset_parameters()", "functionality": "Resets the parameters of the ID-awareness embedding.", "input": "None", "output": "None", "location_or_namespace": "torch.nn.Embedding" }, { "function_call_name": "self.rhs_embedding.reset_parameters()", "functionality": "Resets the parameters of the right-hand-side (item) shallow embedding matrix.", "input": "None", "output": "None", "location_or_namespace": "contextgnn.nn.models.rhsembeddinggnn.RHSEmbeddingGNN" }, { "function_call_name": "self.lin_offset_embgnn.reset_parameters()", "functionality": "Resets parameters of the embgnn offset linear layer.", "input": "None", "output": "None", "location_or_namespace": "torch.nn.Linear" }, { "function_call_name": "self.lin_offset_idgnn.reset_parameters()", "functionality": "Resets parameters of the idgnn offset linear layer.", "input": "None", "output": "None", "location_or_namespace": "torch.nn.Linear" }, { "function_call_name": "self.lhs_projector.reset_parameters()", "functionality": "Resets parameters of the user embedding projection layer.", "input": "None", "output": "None", "location_or_namespace": "torch.nn.Linear" } ] }, { "function_name": "ContextGNN.sample_step", "file_path": "contextgnn/nn/models/contextgnn.py", "function_calls": [ { "function_call_name": "torch.rand()", "functionality": "Generates a tensor of random numbers in [0,1).", "input": "size (int or tuple), device", "output": "Tensor of random floats.", "location_or_namespace": "torch" }, { "function_call_name": "map_index()", "functionality": "Remaps indices according to a reference index set, used for advanced indexing/sampling.", "input": "index, reference index, max_index, inclusive", "output": "Remapped indices and boolean mask.", "location_or_namespace": "torch_geometric.utils.map" }, { "function_call_name": "self.rhs_embedding()", "functionality": "Returns the embedding vectors of the sampled item (RHS) indices.", "input": "rhs_index (Tensor)", "output": "Tensor of embedding vectors.", "location_or_namespace": "contextgnn.nn.models.rhsembeddinggnn.RHSEmbeddingGNN" } ] }, { "function_name": "ContextGNN.construct_logits", "file_path": "contextgnn/nn/models/contextgnn.py", "function_calls": [ { "function_call_name": "Tensor.t()", "functionality": "Returns the transpose of a tensor (for dot product scoring).", "input": "None", "output": "Transposed tensor.", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "self.head()", "functionality": "Applies MLP head to the right-hand-side (item) GNN embeddings for scoring.", "input": "rhs_gnn_embedding (Tensor)", "output": "Score tensor.", "location_or_namespace": "torch_geometric.nn.MLP" }, { "function_call_name": "Tensor.flatten()", "functionality": "Returns a contiguous flattened tensor.", "input": "start_dim=0, end_dim=-1 (optional)", "output": "Flattened tensor.", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "Tensor.sum()", "functionality": "Returns the sum of each row (used for user-item elementwise product).", "input": "dim (int), keepdim (bool)", "output": "Summed tensor.", "location_or_namespace": "torch.Tensor" } ] }, { "function_name": "ContextGNN.forward_gnn", "file_path": "contextgnn/nn/models/contextgnn.py", "function_calls": [ { "function_call_name": "self.encoder()", "functionality": "Encodes tabular/multimodal node features to embedding tensors.", "input": "tf_dict (Dict of TensorFrames)", "output": "Dict of node embeddings.", "location_or_namespace": "contextgnn.nn.encoder.HeteroEncoder" }, { "function_call_name": "self.id_awareness_emb.weight", "functionality": "Returns the weights of the ID-awareness embedding for addition to node features.", "input": "None", "output": "Tensor of embedding weights.", "location_or_namespace": "torch.nn.Embedding" }, { "function_call_name": "self.temporal_encoder()", "functionality": "Encodes relative time into features for each node type.", "input": "seed_time (Tensor), time_dict (Dict), batch_dict (Dict)", "output": "Dict of temporal feature tensors.", "location_or_namespace": "contextgnn.nn.encoder.HeteroTemporalEncoder" }, { "function_call_name": "self.gnn()", "functionality": "Performs message passing and updates node features with GNN.", "input": "x_dict (Dict), edge_index_dict (Dict)", "output": "Dict of updated node embeddings.", "location_or_namespace": "contextgnn.nn.models.HeteroGraphSAGE" } ] }, { "function_name": "ContextGNN.forward", "file_path": "contextgnn/nn/models/contextgnn.py", "function_calls": [ { "function_call_name": "self.forward_gnn()", "functionality": "Obtains context-aware embeddings from the GNN.", "input": "batch (HeteroData), entity_table (NodeType)", "output": "Dict of node embeddings.", "location_or_namespace": "self (ContextGNN)" }, { "function_call_name": "self.lhs_projector()", "functionality": "Projects user embeddings into a common space for dot-product scoring.", "input": "lhs_embedding (Tensor)", "output": "Projected user embedding (Tensor).", "location_or_namespace": "torch.nn.Linear" }, { "function_call_name": "self.rhs_embedding()", "functionality": "Returns the embedding vectors of all candidate items (RHS).", "input": "None", "output": "Tensor of embedding vectors.", "location_or_namespace": "contextgnn.nn.models.rhsembeddinggnn.RHSEmbeddingGNN" }, { "function_call_name": "self.construct_logits()", "functionality": "Fuses two-tower and pair-wise logits as final prediction.", "input": "Various embedding tensors and batch indices.", "output": "Tensor of fused logits.", "location_or_namespace": "self (ContextGNN)" } ] }, { "function_name": "ContextGNN.forward_sample_softmax", "file_path": "contextgnn/nn/models/contextgnn.py", "function_calls": [ { "function_call_name": "self.forward_gnn()", "functionality": "Obtains context-aware embeddings from the GNN.", "input": "batch (HeteroData), entity_table (NodeType)", "output": "Dict of node embeddings.", "location_or_namespace": "self (ContextGNN)" }, { "function_call_name": "self.lhs_projector()", "functionality": "Projects user embeddings into a common space for dot-product scoring.", "input": "lhs_embedding (Tensor)", "output": "Projected user embedding (Tensor).", "location_or_namespace": "torch.nn.Linear" }, { "function_call_name": "self.sample_step()", "functionality": "Selects a subset of RHS indices and associated features for sampled softmax.", "input": "rhs_idgnn_index, lhs_idgnn_batch, rhs_gnn_embedding, src_batch, dst_index", "output": "Sampled indices, embeddings, and associated batch indices.", "location_or_namespace": "self (ContextGNN)" }, { "function_call_name": "self.construct_logits()", "functionality": "Fuses two-tower and pair-wise logits as final prediction.", "input": "Various embedding tensors and batch indices.", "output": "Tensor of fused logits.", "location_or_namespace": "self (ContextGNN)" } ] } ]