File size: 10,322 Bytes
d7ff85b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | [
{
"function_name": "__init__",
"file_path": "TAHyper",
"function_calls": [
{
"function_call_name": "super",
"functionality": "Calls the constructor of the parent class (nn.Module) to ensure proper initialization of the module.",
"input": "TAHyper, self",
"output": "None",
"location_or_namespace": "built-in"
},
{
"function_call_name": "tensor",
"functionality": "Constructs a tensor from data.",
"input": "[args.c]",
"output": "A torch.Tensor object.",
"location_or_namespace": "torch"
},
{
"function_call_name": "to",
"functionality": "Moves a tensor to a specified device (e.g., CPU or GPU).",
"input": "args.device",
"output": "A torch.Tensor on the specified device.",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "Parameter",
"functionality": "Wraps a tensor to be a learnable parameter of a neural network module.",
"input": "torch.Tensor([1.])",
"output": "An nn.Parameter object.",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "getattr",
"functionality": "Retrieves an attribute (function or class) from an object by its name.",
"input": "manifolds, self.manifold_name",
"output": "The class or function object corresponding to the manifold name.",
"location_or_namespace": "built-in"
},
{
"function_call_name": "getattr",
"functionality": "Retrieves an attribute (function or class) from an object by its name.",
"input": "encoders, args.model",
"output": "The class or function object corresponding to the encoder model name.",
"location_or_namespace": "built-in"
},
{
"function_call_name": "Linear",
"functionality": "",
"input": "nhid, nhid, args.dropout, F.relu, args.bias",
"output": "A Linear layer object.",
"location_or_namespace": "hgcn.layers.layers"
},
{
"function_call_name": "Linear",
"functionality": "",
"input": "nhid, 1, args.dropout, lambda x: x, args.bias",
"output": "A Linear layer object.",
"location_or_namespace": "hgcn.layers.layers"
},
{
"function_call_name": "Sequential",
"functionality": "A container module that executes its submodules sequentially.",
"input": "*hnn_layers_y1 or *hnn_layers_y0",
"output": "An nn.Sequential object.",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "Linear",
"functionality": "",
"input": "nhid*2, nhid, args.dropout, F.relu, args.bias",
"output": "A Linear layer object.",
"location_or_namespace": "hgcn.layers.layers"
},
{
"function_call_name": "Linear",
"functionality": "",
"input": "nhid, 1, args.dropout, F.sigmoid, args.bias",
"output": "A Linear layer object.",
"location_or_namespace": "hgcn.layers.layers"
}
]
},
{
"function_name": "encode",
"file_path": "TAHyper",
"function_calls": [
{
"function_call_name": "zeros_like",
"functionality": "Creates a tensor of zeros with the same size as the input tensor.",
"input": "x",
"output": "A tensor of zeros.",
"location_or_namespace": "torch"
},
{
"function_call_name": "cat",
"functionality": "Concatenates the given sequence of tensors in the specified dimension.",
"input": "[o[:, 0:1], x], dim=1",
"output": "A new concatenated tensor.",
"location_or_namespace": "torch"
},
{
"function_call_name": "encode",
"functionality": "",
"input": "x, adj",
"output": "The encoded hyperbolic representation.",
"location_or_namespace": "hgcn.models.encoders"
}
]
},
{
"function_name": "uplift_decode",
"file_path": "TAHyper",
"function_calls": [
{
"function_call_name": "logmap0",
"functionality": "",
"input": "rep, c=self.c",
"output": "The mapped representation.",
"location_or_namespace": "hgcn.manifolds"
},
{
"function_call_name": "proj_tan0",
"functionality": "",
"input": "self.manifold.logmap0(rep, c=self.c), c=self.c",
"output": "The projected representation.",
"location_or_namespace": "hgcn.manifolds"
},
{
"function_call_name": "layers_y0",
"functionality": "Performs a forward pass through the sequential layers for the control group.",
"input": "rep",
"output": "The output of the sequential layers.",
"location_or_namespace": "TAHyper"
},
{
"function_call_name": "layers_y1",
"functionality": "Performs a forward pass through the sequential layers for the treated group.",
"input": "rep",
"output": "The output of the sequential layers.",
"location_or_namespace": "TAHyper"
},
{
"function_call_name": "y0_out",
"functionality": "Performs a forward pass through the final output layer for the control group.",
"input": "y0",
"output": "The predicted outcome for the control group.",
"location_or_namespace": "TAHyper"
},
{
"function_call_name": "y1_out",
"functionality": "Performs a forward pass through the final output layer for the treated group.",
"input": "y1",
"output": "The predicted outcome for the treated group.",
"location_or_namespace": "TAHyper"
},
{
"function_call_name": "view",
"functionality": "Reshapes a tensor.",
"input": "-1",
"output": "The reshaped tensor.",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "where",
"functionality": "Returns a new tensor with elements from y1 or y0, depending on the condition.",
"input": "t > 0,y1,y0",
"output": "A new tensor with the selected values.",
"location_or_namespace": "torch"
}
]
},
{
"function_name": "lp_cls",
"file_path": "TAHyper",
"function_calls": [
{
"function_call_name": "normalize",
"functionality": "",
"input": "h",
"output": "The normalized tensor.",
"location_or_namespace": "hgcn.manifolds"
},
{
"function_call_name": "logmap0",
"functionality": "",
"input": "h, c=self.c",
"output": "The mapped representation.",
"location_or_namespace": "hgcn.manifolds"
},
{
"function_call_name": "proj_tan0",
"functionality": "",
"input": "self.manifold.logmap0(h, c=self.c), c=self.c",
"output": "The projected representation.",
"location_or_namespace": "hgcn.manifolds"
},
{
"function_call_name": "cat",
"functionality": "Concatenates the given sequence of tensors in the specified dimension.",
"input": "[emb_in, emb_out_samet], axis=-1 or [emb_in, emb_out_difft], axis=-1",
"output": "A new concatenated tensor.",
"location_or_namespace": "torch"
},
{
"function_call_name": "out_nn1",
"functionality": "Performs a forward pass through the first layer of the MLP for treatment-aware relationship identification.",
"input": "pos_input or neg_input",
"output": "The output of the first MLP layer.",
"location_or_namespace": "TAHyper"
},
{
"function_call_name": "out_nn",
"functionality": "Performs a forward pass through the final output layer of the MLP for relationship identification.",
"input": "pos_input or neg_input",
"output": "The scores for positive or negative pairs.",
"location_or_namespace": "TAHyper"
},
{
"function_call_name": "squeeze",
"functionality": "Removes a dimension of size one from a tensor.",
"input": "()",
"output": "The squeezed tensor.",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "binary_cross_entropy",
"functionality": "Calculates the Binary Cross Entropy loss.",
"input": "pos_scores, torch.ones_like(pos_scores), reduction=\"none\" or neg_scores, torch.zeros_like(neg_scores), reduction=\"none\"",
"output": "The BCE loss.",
"location_or_namespace": "torch.nn.functional"
},
{
"function_call_name": "ones_like",
"functionality": "Creates a tensor of ones with the same size as the input tensor.",
"input": "pos_scores",
"output": "A tensor of ones.",
"location_or_namespace": "torch"
},
{
"function_call_name": "zeros_like",
"functionality": "Creates a tensor of zeros with the same size as the input tensor.",
"input": "neg_scores",
"output": "A tensor of zeros.",
"location_or_namespace": "torch"
},
{
"function_call_name": "mean",
"functionality": "Calculates the mean value of all elements in a tensor.",
"input": "axis=-1",
"output": "The mean of the tensor.",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "forward",
"file_path": "TAHyper",
"function_calls": [
{
"function_call_name": "encode",
"functionality": "Performs the hyperbolic confounder representation learning.",
"input": "x, adj",
"output": "The learned hyperbolic representation 'rep'.",
"location_or_namespace": "TAHyper"
},
{
"function_call_name": "uplift_decode",
"functionality": "Performs potential outcome prediction.",
"input": "rep, t",
"output": "The predicted factual outcome 'y' and a placeholder 'p1'.",
"location_or_namespace": "TAHyper"
},
{
"function_call_name": "lp_cls",
"functionality": "Implements the treatment-aware relationship identification module and returns its loss.",
"input": "rep, idx",
"output": "The cross-entropy loss for the relationship classification task, 'minus'.",
"location_or_namespace": "TAHyper"
}
]
}
] |