File size: 30,455 Bytes
22e9602
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
[
  {
    "function_name": "Exp_Main.__init__",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "super().__init__",
        "functionality": "Initializes the parent class 'Exp_Basic' to set up the basic experiment environment, including model, device, and arguments.",
        "input": "args",
        "output": "None",
        "location_or_namespace": "exp/exp_basic.py"
      },
      {
        "function_call_name": "nn.KLDivLoss",
        "functionality": "Creates a criterion that measures the Kullback-Leibler divergence. It is used for the variance component of the PS Loss.",
        "input": "reduction='none'",
        "output": "A callable KLDivLoss object.",
        "location_or_namespace": "torch.nn"
      }
    ]
  },
  {
    "function_name": "Exp_Main._build_model",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "Model",
        "functionality": "Initializes a time series forecasting model (e.g., DLinear, Autoformer) based on the provided arguments.",
        "input": "self.args",
        "output": "A PyTorch model object.",
        "location_or_namespace": "models"
      },
      {
        "function_call_name": "float",
        "functionality": "Casts the model's parameters and buffers to float data type.",
        "input": "None",
        "output": "The model with float data type parameters.",
        "location_or_namespace": "torch.nn.Module"
      },
      {
        "function_call_name": "nn.DataParallel",
        "functionality": "Implements data parallelism at the module level to use multiple GPUs.",
        "input": "model, device_ids=self.args.device_ids",
        "output": "A DataParallel wrapper around the model.",
        "location_or_namespace": "torch.nn"
      }
    ]
  },
  {
    "function_name": "Exp_Main._get_data",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "data_provider",
        "functionality": "Factory function to create a dataset and data loader based on the specified arguments and data flag ('train', 'val', or 'test').",
        "input": "self.args, flag",
        "output": "A tuple containing the dataset and data loader.",
        "location_or_namespace": "data_provider/data_factory.py"
      }
    ]
  },
  {
    "function_name": "Exp_Main._select_optimizer",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "optim.Adam",
        "functionality": "Initializes the Adam optimizer with the model's parameters and a specified learning rate.",
        "input": "self.model.parameters(), lr=self.args.learning_rate",
        "output": "An Adam optimizer object.",
        "location_or_namespace": "torch.optim"
      }
    ]
  },
  {
    "function_name": "Exp_Main._select_criterion",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "nn.MSELoss",
        "functionality": "Creates a criterion that measures the mean-squared error between each element in the input and target.",
        "input": "None",
        "output": "An MSELoss object.",
        "location_or_namespace": "torch.nn"
      }
    ]
  },
  {
    "function_name": "Exp_Main.create_patches",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "permute",
        "functionality": "Returns a view of the original tensor with its dimensions permuted.",
        "input": "0, 2, 1",
        "output": "A view of the tensor with permuted dimensions.",
        "location_or_namespace": "torch.Tensor"
      },
      {
        "function_call_name": "unfold",
        "functionality": "Returns a view of the original tensor which contains all slices of size `patch_len` from the specified dimension.",
        "input": "2, patch_len, stride",
        "output": "A view of the tensor containing all slices.",
        "location_or_namespace": "torch.Tensor"
      },
      {
        "function_call_name": "reshape",
        "functionality": "Returns a tensor with the same data and number of elements as the input, but with the specified shape.",
        "input": "B, C, num_patches, patch_len",
        "output": "A reshaped tensor.",
        "location_or_namespace": "torch.Tensor"
      }
    ]
  },
  {
    "function_name": "Exp_Main.fouriour_based_adaptive_patching",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "torch.fft.rfft",
        "functionality": "Computes the one-dimensional discrete Fourier Transform for real input.",
        "input": "true, dim=1",
        "output": "The Fourier-transformed tensor.",
        "location_or_namespace": "torch.fft"
      },
      {
        "function_call_name": "torch.abs",
        "functionality": "Computes the absolute value of each element in the input tensor.",
        "input": "true_fft",
        "output": "A tensor with absolute values.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "mean",
        "functionality": "Computes the mean of all elements in the tensor along specified dimensions.",
        "input": "0, -1",
        "output": "A tensor with the mean values.",
        "location_or_namespace": "torch.Tensor"
      },
      {
        "function_call_name": "torch.argmax",
        "functionality": "Returns the indices of the maximum value of all elements in the input tensor.",
        "input": "frequency_list",
        "output": "A tensor with the index of the maximum value.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "min",
        "functionality": "Returns the smallest of its arguments.",
        "input": "period // 2, self.patch_len_threshold",
        "output": "The minimum value.",
        "location_or_namespace": "built-in"
      },
      {
        "function_call_name": "self.create_patches",
        "functionality": "Segments a time series tensor into overlapping patches.",
        "input": "true, patch_len, stride=stride",
        "output": "A tensor of patches.",
        "location_or_namespace": "exp/exp_main.py"
      }
    ]
  },
  {
    "function_name": "Exp_Main.patch_wise_structural_loss",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "torch.mean",
        "functionality": "Computes the mean value of all elements in the input tensor.",
        "input": "tensor, dim=-1, keepdim=True",
        "output": "A tensor containing the mean value.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.var",
        "functionality": "Computes the variance of all elements in the input tensor.",
        "input": "tensor, dim=-1, keepdim=True, unbiased=False",
        "output": "A tensor containing the variance.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.sqrt",
        "functionality": "Computes the square-root of each element in the input tensor.",
        "input": "variance_tensor",
        "output": "A tensor containing the standard deviation.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.softmax",
        "functionality": "Applies the Softmax function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range [0,1] and sum to 1.",
        "input": "true_patch, dim=-1",
        "output": "A tensor with softmax-normalized values.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.log_softmax",
        "functionality": "Applies a softmax followed by a logarithm.",
        "input": "pred_patch, dim=-1",
        "output": "A tensor with log-softmax-normalized values.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "self.kl_loss",
        "functionality": "Computes the Kullback-Leibler divergence loss between two distributions.",
        "input": "pred_patch_softmax, true_patch_softmax",
        "output": "A tensor containing the KL divergence loss.",
        "location_or_namespace": "torch.nn.KLDivLoss"
      },
      {
        "function_call_name": "torch.abs",
        "functionality": "Computes the absolute value of each element in the input tensor.",
        "input": "true_patch_mean - pred_patch_mean",
        "output": "A tensor containing absolute differences.",
        "location_or_namespace": "torch"
      }
    ]
  },
  {
    "function_name": "Exp_Main.ps_loss",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "self.fouriour_based_adaptive_patching",
        "functionality": "Determines patch length from the dominant frequency of the ground truth series and segments both series into patches.",
        "input": "true, pred",
        "output": "A tuple of patched ground truth and prediction tensors.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "self.patch_wise_structural_loss",
        "functionality": "Calculates the three components of the Patch-wise Structural loss: correlation, variance, and mean.",
        "input": "true_patch, pred_patch",
        "output": "A tuple containing the correlation, variance, and mean losses.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "self.gradient_based_dynamic_weighting",
        "functionality": "Implements the Gradient-based Dynamic Weighting (GDW) strategy to balance the three loss components.",
        "input": "true, pred, corr_loss, var_loss, mean_loss",
        "output": "A tuple of weights (alpha, beta, gamma).",
        "location_or_namespace": "exp/exp_main.py"
      }
    ]
  },
  {
    "function_name": "Exp_Main.gradient_based_dynamic_weighting",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "permute",
        "functionality": "Returns a view of the original tensor with its dimensions permuted.",
        "input": "0, 2, 1",
        "output": "A view of the tensor with permuted dimensions.",
        "location_or_namespace": "torch.Tensor"
      },
      {
        "function_call_name": "torch.mean",
        "functionality": "Computes the mean value of all elements in the input tensor.",
        "input": "tensor, dim=-1, keepdim=True",
        "output": "A tensor containing the mean value.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.var",
        "functionality": "Computes the variance of all elements in the input tensor.",
        "input": "tensor, dim=-1, keepdim=True, unbiased=False",
        "output": "A tensor containing the variance.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.sqrt",
        "functionality": "Computes the square-root of each element in the input tensor.",
        "input": "variance_tensor",
        "output": "A tensor containing the standard deviation.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.autograd.grad",
        "functionality": "Computes and returns the sum of gradients of outputs with respect to the inputs.",
        "input": "loss, self.model.Linear_Trend.parameters(), create_graph=True",
        "output": "A tuple of gradients.",
        "location_or_namespace": "torch.autograd"
      },
      {
        "function_call_name": "norm",
        "functionality": "Returns the L2-norm of the tensor.",
        "input": "None",
        "output": "A scalar tensor representing the norm.",
        "location_or_namespace": "torch.Tensor"
      },
      {
        "function_call_name": "detach",
        "functionality": "Returns a new tensor, detached from the current graph. The result will never require gradient.",
        "input": "None",
        "output": "A detached tensor.",
        "location_or_namespace": "torch.Tensor"
      }
    ]
  },
  {
    "function_name": "Exp_Main.vali",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "self.model.eval",
        "functionality": "Sets the model to evaluation mode.",
        "input": "None",
        "output": "None",
        "location_or_namespace": "torch.nn.Module"
      },
      {
        "function_call_name": "enumerate",
        "functionality": "Returns an enumerate object, which yields pairs containing a count and a value from the iterable.",
        "input": "vali_loader",
        "output": "An iterator of (index, batch) tuples.",
        "location_or_namespace": "built-in"
      },
      {
        "function_call_name": "torch.zeros_like",
        "functionality": "Returns a tensor filled with the scalar value 0, with the same size as input.",
        "input": "batch_y[:, -self.args.pred_len:, :]",
        "output": "A tensor of zeros.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.cat",
        "functionality": "Concatenates the given sequence of tensors in the given dimension.",
        "input": "[batch_y[:, :self.args.label_len, :], dec_inp], dim=1",
        "output": "A concatenated tensor.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "self.model",
        "functionality": "Performs a forward pass of the model to generate predictions.",
        "input": "batch_x, batch_x_mark, dec_inp, batch_y_mark",
        "output": "The model's output tensor.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "criterion",
        "functionality": "Computes the loss between the predictions and the ground truth.",
        "input": "pred, true",
        "output": "A scalar tensor representing the loss.",
        "location_or_namespace": "torch.nn"
      },
      {
        "function_call_name": "np.average",
        "functionality": "Computes the weighted average along the specified axis.",
        "input": "total_loss",
        "output": "The average loss.",
        "location_or_namespace": "numpy"
      },
      {
        "function_call_name": "self.model.train",
        "functionality": "Sets the model to training mode.",
        "input": "None",
        "output": "None",
        "location_or_namespace": "torch.nn.Module"
      }
    ]
  },
  {
    "function_name": "Exp_Main.train",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "self._get_data",
        "functionality": "Gets the dataset and data loader for a specified flag ('train', 'val', or 'test').",
        "input": "flag='train'",
        "output": "A tuple of dataset and data loader.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "os.path.join",
        "functionality": "Joins one or more path components intelligently.",
        "input": "self.args.checkpoints, setting",
        "output": "A string representing the full path.",
        "location_or_namespace": "os.path"
      },
      {
        "function_call_name": "os.makedirs",
        "functionality": "Recursive directory creation function.",
        "input": "path",
        "output": "None",
        "location_or_namespace": "os"
      },
      {
        "function_call_name": "time.time",
        "functionality": "Returns the time in seconds since the epoch as a floating point number.",
        "input": "None",
        "output": "The current time as a float.",
        "location_or_namespace": "time"
      },
      {
        "function_call_name": "EarlyStopping",
        "functionality": "Initializes an early stopping handler to monitor validation loss and stop training if it doesn't improve.",
        "input": "patience=self.args.patience, verbose=True",
        "output": "An EarlyStopping object.",
        "location_or_namespace": "utils/tools.py"
      },
      {
        "function_call_name": "self._select_optimizer",
        "functionality": "Selects and initializes the optimizer for training.",
        "input": "None",
        "output": "An optimizer object.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "self._select_criterion",
        "functionality": "Selects and initializes the primary loss function.",
        "input": "None",
        "output": "A criterion object.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "torch.cuda.amp.GradScaler",
        "functionality": "Creates a gradient scaler for automatic mixed-precision training.",
        "input": "None",
        "output": "A GradScaler object.",
        "location_or_namespace": "torch.cuda.amp"
      },
      {
        "function_call_name": "self.model.train",
        "functionality": "Sets the model to training mode.",
        "input": "None",
        "output": "None",
        "location_or_namespace": "torch.nn.Module"
      },
      {
        "function_call_name": "enumerate",
        "functionality": "Returns an enumerate object, which yields pairs containing a count and a value from the iterable.",
        "input": "train_loader",
        "output": "An iterator of (index, batch) tuples.",
        "location_or_namespace": "built-in"
      },
      {
        "function_call_name": "model_optim.zero_grad",
        "functionality": "Sets the gradients of all optimized tensors to zero.",
        "input": "None",
        "output": "None",
        "location_or_namespace": "torch.optim.Optimizer"
      },
      {
        "function_call_name": "torch.cat",
        "functionality": "Concatenates the given sequence of tensors in the given dimension.",
        "input": "[batch_y[:, :self.args.label_len, :], dec_inp], dim=1",
        "output": "A concatenated tensor.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "self.model",
        "functionality": "Performs a forward pass of the model to generate predictions.",
        "input": "batch_x, batch_x_mark, dec_inp, batch_y_mark, batch_y",
        "output": "The model's output tensor.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "criterion",
        "functionality": "Computes the primary loss between predictions and ground truth.",
        "input": "outputs, batch_y",
        "output": "A scalar tensor representing the loss.",
        "location_or_namespace": "torch.nn"
      },
      {
        "function_call_name": "self.ps_loss",
        "functionality": "Computes the total Patch-wise Structural loss.",
        "input": "batch_y, outputs",
        "output": "A scalar tensor representing the PS loss.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "loss.backward",
        "functionality": "Computes the gradient of the loss with respect to graph leaves.",
        "input": "None",
        "output": "None",
        "location_or_namespace": "torch.Tensor"
      },
      {
        "function_call_name": "model_optim.step",
        "functionality": "Performs a single optimization step (parameter update).",
        "input": "None",
        "output": "None",
        "location_or_namespace": "torch.optim.Optimizer"
      },
      {
        "function_call_name": "np.average",
        "functionality": "Compute the weighted average along the specified axis.",
        "input": "train_loss",
        "output": "The average loss.",
        "location_or_namespace": "numpy"
      },
      {
        "function_call_name": "self.vali",
        "functionality": "Evaluates the model on the validation dataset.",
        "input": "vali_data, vali_loader, criterion",
        "output": "The average validation loss.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "early_stopping",
        "functionality": "Checks the validation loss and determines if training should stop early.",
        "input": "vali_loss, self.model, path",
        "output": "None",
        "location_or_namespace": "utils/tools.py"
      },
      {
        "function_call_name": "adjust_learning_rate",
        "functionality": "Adjusts the learning rate of the optimizer based on the current epoch.",
        "input": "model_optim, epoch + 1, self.args",
        "output": "None",
        "location_or_namespace": "utils/tools.py"
      },
      {
        "function_call_name": "torch.load",
        "functionality": "Loads an object saved with torch.save() from a file.",
        "input": "best_model_path, map_location='cuda:0'",
        "output": "The loaded object, typically a state dictionary.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "self.model.load_state_dict",
        "functionality": "Loads a model's parameter dictionary.",
        "input": "torch.load(best_model_path, map_location='cuda:0')",
        "output": "None",
        "location_or_namespace": "torch.nn.Module"
      }
    ]
  },
  {
    "function_name": "Exp_Main.test",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "self._get_data",
        "functionality": "Gets the dataset and data loader for the test set.",
        "input": "flag='test'",
        "output": "A tuple of dataset and data loader.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "self.model.load_state_dict",
        "functionality": "Loads a model's parameter dictionary from a checkpoint file.",
        "input": "torch.load(os.path.join('./checkpoints/' + setting, 'checkpoint.pth'))",
        "output": "None",
        "location_or_namespace": "torch.nn.Module"
      },
      {
        "function_call_name": "torch.load",
        "functionality": "Loads an object saved with torch.save() from a file.",
        "input": "os.path.join('./checkpoints/' + setting, 'checkpoint.pth')",
        "output": "The loaded state dictionary.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "os.path.join",
        "functionality": "Joins one or more path components intelligently.",
        "input": "'./test_results/' + setting + '/', str(i) + '.pdf'",
        "output": "A string representing the full path.",
        "location_or_namespace": "os.path"
      },
      {
        "function_call_name": "os.makedirs",
        "functionality": "Recursive directory creation function.",
        "input": "folder_path",
        "output": "None",
        "location_or_namespace": "os"
      },
      {
        "function_call_name": "self.model.eval",
        "functionality": "Sets the model to evaluation mode.",
        "input": "None",
        "output": "None",
        "location_or_namespace": "torch.nn.Module"
      },
      {
        "function_call_name": "enumerate",
        "functionality": "Returns an enumerate object, which yields pairs containing a count and a value from the iterable.",
        "input": "test_loader",
        "output": "An iterator of (index, batch) tuples.",
        "location_or_namespace": "built-in"
      },
      {
        "function_call_name": "torch.cat",
        "functionality": "Concatenates the given sequence of tensors in the given dimension.",
        "input": "[batch_y[:, :self.args.label_len, :], dec_inp], dim=1",
        "output": "A concatenated tensor.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "self.model",
        "functionality": "Performs a forward pass of the model to generate predictions.",
        "input": "batch_x, batch_x_mark, dec_inp, batch_y_mark",
        "output": "The model's output tensor.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "detach",
        "functionality": "Returns a new tensor, detached from the current graph.",
        "input": "None",
        "output": "A detached tensor.",
        "location_or_namespace": "torch.Tensor"
      },
      {
        "function_call_name": "visual",
        "functionality": "Generates and saves a plot visualizing the ground truth and prediction.",
        "input": "gt, pd, os.path.join(folder_path, str(i) + '.pdf')",
        "output": "None",
        "location_or_namespace": "utils/tools.py"
      },
      {
        "function_call_name": "test_params_flop",
        "functionality": "Tests the model's parameters and FLOPs.",
        "input": "(batch_x.shape[1],batch_x.shape[2])",
        "output": "None",
        "location_or_namespace": "utils/tools.py"
      },
      {
        "function_call_name": "np.concatenate",
        "functionality": "Joins a sequence of arrays along an existing axis.",
        "input": "preds, axis=0",
        "output": "The concatenated numpy array.",
        "location_or_namespace": "numpy"
      },
      {
        "function_call_name": "metric",
        "functionality": "Computes various evaluation metrics like MSE, MAE, RSE, and CORR.",
        "input": "preds, trues",
        "output": "A tuple of metric values.",
        "location_or_namespace": "utils/metrics.py"
      },
      {
        "function_call_name": "open",
        "functionality": "Opens a file and returns a corresponding file object.",
        "input": "'result.txt', 'a'",
        "output": "A file object.",
        "location_or_namespace": "built-in"
      },
      {
        "function_call_name": "np.save",
        "functionality": "Saves an array to a binary file in NumPy .npy format.",
        "input": "folder_path + 'pred.npy', preds",
        "output": "None",
        "location_or_namespace": "numpy"
      }
    ]
  },
  {
    "function_name": "Exp_Main.predict",
    "file_path": "exp/exp_main.py",
    "function_calls": [
      {
        "function_call_name": "self._get_data",
        "functionality": "Gets the dataset and data loader for prediction.",
        "input": "flag='pred'",
        "output": "A tuple of dataset and data loader.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "os.path.join",
        "functionality": "Joins one or more path components intelligently.",
        "input": "self.args.checkpoints, setting",
        "output": "A string representing the full path.",
        "location_or_namespace": "os.path"
      },
      {
        "function_call_name": "self.model.load_state_dict",
        "functionality": "Loads a model's parameter dictionary from a checkpoint file.",
        "input": "torch.load(best_model_path)",
        "output": "None",
        "location_or_namespace": "torch.nn.Module"
      },
      {
        "function_call_name": "torch.load",
        "functionality": "Loads an object saved with torch.save() from a file.",
        "input": "best_model_path",
        "output": "The loaded state dictionary.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "self.model.eval",
        "functionality": "Sets the model to evaluation mode.",
        "input": "None",
        "output": "None",
        "location_or_namespace": "torch.nn.Module"
      },
      {
        "function_call_name": "enumerate",
        "functionality": "Returns an enumerate object, which yields pairs containing a count and a value from the iterable.",
        "input": "pred_loader",
        "output": "An iterator of (index, batch) tuples.",
        "location_or_namespace": "built-in"
      },
      {
        "function_call_name": "torch.zeros",
        "functionality": "Returns a tensor filled with the scalar value 0, with the shape defined by the variable argument.",
        "input": "[batch_y.shape[0], self.args.pred_len, batch_y.shape[2]]",
        "output": "A tensor of zeros.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "torch.cat",
        "functionality": "Concatenates the given sequence of tensors in the given dimension.",
        "input": "[batch_y[:, :self.args.label_len, :], dec_inp], dim=1",
        "output": "A concatenated tensor.",
        "location_or_namespace": "torch"
      },
      {
        "function_call_name": "self.model",
        "functionality": "Performs a forward pass of the model to generate predictions.",
        "input": "batch_x, batch_x_mark, dec_inp, batch_y_mark",
        "output": "The model's output tensor.",
        "location_or_namespace": "exp/exp_main.py"
      },
      {
        "function_call_name": "detach",
        "functionality": "Returns a new tensor, detached from the current graph.",
        "input": "None",
        "output": "A detached tensor.",
        "location_or_namespace": "torch.Tensor"
      },
      {
        "function_call_name": "np.array",
        "functionality": "Creates a numpy array.",
        "input": "preds",
        "output": "A numpy array.",
        "location_or_namespace": "numpy"
      },
      {
        "function_call_name": "np.concatenate",
        "functionality": "Joins a sequence of arrays along an existing axis.",
        "input": "preds, axis=0",
        "output": "The concatenated numpy array.",
        "location_or_namespace": "numpy"
      },
      {
        "function_call_name": "pred_data.inverse_transform",
        "functionality": "Reverses the scaling transformation applied to the data.",
        "input": "preds",
        "output": "The inverse-transformed data.",
        "location_or_namespace": "data_provider/data_loader.py"
      },
      {
        "function_call_name": "os.makedirs",
        "functionality": "Recursive directory creation function.",
        "input": "folder_path",
        "output": "None",
        "location_or_namespace": "os"
      },
      {
        "function_call_name": "np.save",
        "functionality": "Saves an array to a binary file in NumPy .npy format.",
        "input": "folder_path + 'real_prediction.npy', preds",
        "output": "None",
        "location_or_namespace": "numpy"
      },
      {
        "function_call_name": "pd.DataFrame",
        "functionality": "Creates a two-dimensional, size-mutable, potentially heterogeneous tabular data structure with labeled axes.",
        "input": "np.append(...), columns=pred_data.cols",
        "output": "A pandas DataFrame.",
        "location_or_namespace": "pandas"
      }
    ]
  }
]