cesar 2 months ago
parent
commit
a5f24556dd
3 changed files with 27 additions and 13 deletions
  1. BIN
      paper/Adapt25_Paper_Template_updated_AKO_v1.docx
  2. 16
    0
      plotFScore_v5.py
  3. 11
    13
      v5_class.py

BIN
paper/Adapt25_Paper_Template_updated_AKO_v1.docx View File


+ 16
- 0
plotFScore_v5.py View File

@@ -0,0 +1,16 @@
1
+# Csar Fdez, UdL, 2025
2
+# Plots paper's bar plots of FSCore
3
+import matplotlib.pyplot as plt
4
+import numpy as np
5
+
6
+F={}
7
+for i in range(4,29,4):
8
+    F[i]=np.ones(6)
9
+for i in range(4,29,4):
10
+    for j in range(6):
11
+        F[i][j]=np.random.uniform(0.8,1)
12
+
13
+
14
+# https://stackoverflow.com/questions/10369681/how-to-plot-bar-graphs-with-same-x-coordinates-side-by-side-dodged
15
+
16
+print(F)

+ 11
- 13
v5_class.py View File

@@ -42,7 +42,7 @@ parser.add_option("-p", "--plot", dest="plot", help="Only plot data (false)", de
42 42
 # 5.  Open door
43 43
 
44 44
 
45
-NumberOfFailures=4  # So far, we have only data for the first 4 types of failures
45
+NumberOfFailures=3  # So far, we have only data for the first 4 types of failures
46 46
 datafiles=[[],[]]   # 0 for train,  1 for test
47 47
 for i in range(NumberOfFailures+1):
48 48
     datafiles[0].append([])
@@ -53,21 +53,21 @@ datafiles[0][0]=['2024-08-07_5_','2024-08-08_5_','2025-01-25_5_','2025-01-26_5_'
53 53
 datafiles[0][1]=['2024-12-11_5_', '2024-12-12_5_','2024-12-13_5_'] 
54 54
 datafiles[0][2]=['2024-12-18_5_','2024-12-21_5_','2024-12-22_5_','2024-12-23_5_','2024-12-24_5_'] 
55 55
 datafiles[0][3]=['2024-12-28_5_','2024-12-29_5_','2024-12-30_5_'] 
56
-datafiles[0][4]=['2025-02-13_5_']
56
+#datafiles[0][4]=['2025-02-13_5_']
57 57
 
58 58
 if options.transition:
59 59
     datafiles[1][0]=['2025-01-27_5_','2025-01-28_5_'] 
60 60
     datafiles[1][1]=['2024-12-14_5_','2024-12-15_5_','2024-12-16_5_']  # with TRANSITION
61 61
     datafiles[1][2]=['2024-12-17_5_','2024-12-19_5_','2024-12-25_5_','2024-12-26_5_'] # with TRANSITION
62 62
     datafiles[1][3]=['2024-12-27_5_','2024-12-31_5_','2025-01-01_5_'] # with TRANSITION
63
-    datafiles[1][4]=['2025-02-12_5_','2025-02-13_5_']
63
+    #datafiles[1][4]=['2025-02-12_5_','2025-02-13_5_']
64 64
 
65 65
 else:
66 66
     datafiles[1][0]=['2025-01-27_5_','2025-01-28_5_'] 
67 67
     datafiles[1][1]=['2024-12-14_5_','2024-12-15_5_'] 
68 68
     datafiles[1][2]=['2024-12-19_5_','2024-12-25_5_','2024-12-26_5_'] 
69 69
     datafiles[1][3]=['2024-12-31_5_','2025-01-01_5_'] 
70
-    datafiles[1][4]=['2025-02-13_5_']
70
+    #datafiles[1][4]=['2025-02-13_5_']
71 71
  
72 72
 
73 73
 #datafiles[0][4]=['2025-02-05_5_'] 
@@ -86,11 +86,11 @@ features=['r1 s1','r1 s4','r1 s5']
86 86
 features=['r1 s5']
87 87
 # Feature combination suggested by AKO
88 88
 #features=['r1 s1','r1 s4','r1 s5','pa1 apiii']
89
-features=['r1 s1','r1 s4','r1 s5']
89
+#features=['r1 s1','r1 s4','r1 s5']
90 90
 #features=['r1 s1','r1 s5','pa1 apiii']
91 91
 #features=['r1 s5','pa1 apiii']
92 92
 #features=['r1 s1','r1 s5']
93
-#features=['r1 s5']
93
+features=['r1 s5']
94 94
 
95 95
 
96 96
 
@@ -318,8 +318,8 @@ def plotData():
318 318
 
319 319
 
320 320
 #   2nd scenario. Go over anomalies and classify it by less error
321
-#datalist=[dataTestNorm[0],dataTestNorm[1],dataTestNorm[2],dataTestNorm[3]]
322
-datalist=[dataTestNorm[0],dataTestNorm[1],dataTestNorm[2],dataTestNorm[3],dataTestNorm[4]]
321
+datalist=[dataTestNorm[0],dataTestNorm[1],dataTestNorm[2],dataTestNorm[3]]
322
+#datalist=[dataTestNorm[0],dataTestNorm[1],dataTestNorm[2],dataTestNorm[3],dataTestNorm[4]]
323 323
 x_test=create_sequences(datalist[0],int(options.timesteps))
324 324
 for i in range(1,len(datalist)):
325 325
     x_test=np.vstack((x_test,create_sequences(datalist[i],int(options.timesteps))))
@@ -336,7 +336,7 @@ if options.plot:
336 336
     plotData()
337 337
     exit(0)
338 338
 
339
-testClasses=[0,1,2,3,4]
339
+testClasses=[0,1,2,3]
340 340
 
341 341
 if not len(testClasses)==len(testRanges):
342 342
     print("ERROR:  testClasses and testRanges must have same length")
@@ -460,7 +460,8 @@ def anomalyMetric(classes,testranges,testclasses):
460 460
     print("F1-Score: ",F1)
461 461
 
462 462
 anomalyMetric(classes,testRanges,testClasses)
463
-
463
+#plotData4()
464
+exit(0)
464 465
 # Compute delay until correct detection for a list of ranges (when transition data exists)
465 466
 def computeDelay(l,classes,testRanges,testClasses):
466 467
     d=np.zeros(len(l))
@@ -482,9 +483,6 @@ def computeDelay(l,classes,testRanges,testClasses):
482 483
     print(d)
483 484
     return(d.mean())
484 485
 
485
-print(testRanges)
486 486
 d=computeDelay([2,3,4],classes,testRanges,testClasses)
487
-print("mean delay: ",d)
488
-plotData4()
489 487
 
490 488
 

Powered by TurnKey Linux.